A unified system for managing multiple notification resources.
Each supported resource is organized into a table of handlers, with a trigger function and type mapping.
This approach enables easy integration and switching between resources.
Developers can simply extend the handlers table to add support for additional resources if required.
Handlers
Table of handlers for notification resources.
Covered by default: boii_ui, ox_lib, qb-core, es_extended, okokNotify
Client
local handlers = {
default = function(options)
TriggerEvent('boii_utils:notify', { type = options.type, header = options.header, message = options.message, duration = options.duration })
end,
boii_core = function(options)
TriggerEvent('boii_core:notify', { type = options.type, header = options.header, message = options.message, duration = options.duration })
end,
boii_ui = function(options)
TriggerEvent('boii_ui:notify', { type = options.type, header = options.header, message = options.message, duration = options.duration })
end,
ox_lib = function(options)
TriggerEvent('ox_lib:notify', { type = options.type, title = options.header, description = options.message })
end,
es_extended = function(options)
TriggerEvent('ESX:Notify', options.type, options.duration, options.message)
end,
['qb-core'] = function(options)
local type_mapping = { information = 'primary', info = 'primary' }
options.type = type_mapping[options.type] or options.type
TriggerEvent('QBCore:Notify', options.message, options.type, options.duration)
end,
okokNotify = function(options)
TriggerEvent('okokNotify:Alert', options.header or 'Notification', options.message, options.type, options.duration or 5000)
end
}