Giter VIP home page Giter VIP logo

codexis-notifications's Introduction

Preview

Informations

Simple notification system with two type of notifications :

  • Simple notification
  • Job notification

You will have to put your own image in the images folder for the job notification to work properly.

Usage

  • Simple notification
exports['codexis-notifications']:Notification({
   id = 'test', -- default is auto-generated
   message = 'Test notification', -- required
   type = 'success', -- default is success
   duration = 10000, -- default is 5000
})
  • Job notification
exports['codexis-notifications']:JobNotification({
   id = 'test', -- default is auto-generated
   job = 'burgershot', -- required | This is the name of the image in web/build/images | require .png
   name = 'Burger Shot', -- required | This is the name of the job
   color = 'Burger Shot', -- required | Can be rgb or rgba or css color
   number = 'Burger Shot', -- not required | Can be rgb or rgba or css color
   message = '25% sale on all items', -- required
   type = 'information', -- default is information
   duration = 10000, -- default is 5000
})

Snippets

  • From qb-core to mine, change the function QBCore.Functions.Notify in qb-core/client/functions.lua with :
function QBCore.Functions.Notify(text, texttype, length)
    if type(text) == "table" then
        local ttext = text.text or 'Placeholder'
        exports['codexis-notifications']:Notification({
           message = ttext,
           type = texttype,
           duration = length,
        })
    else
        exports['codexis-notifications']:Notification({
           message = text,
           type = texttype,
           duration = length,
        })
    end
end
  • From es_extended to mine, change the function ESX.ShowNotification in es_extended/client/functions.lua with :
function ESX.ShowNotification(message, type, length)
    if GetResourceState("codexis-notifications") ~= "missing" then
        return exports['codexis-notifications']:Notification({
           message = message,
           type = type,
           duration = length,
        })
    end
end

Credits

Thanks to overextended for giving me some hints and better code practice when I watch their code

codexis-notifications's People

Contributors

codexisphantom avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.