mirror of
https://github.com/CommunityOx/ox_lib.git
synced 2026-08-17 23:16:03 +01:00
* update(notify): add warning it's own type * update(notify): inform > info, change warning default icon to circle * fix typo * update(notify): case for def notifs, update icons use circle icons for all notifs so its more unified, also looks a bit better imo * fix(progressBar): spamming cancel spamming cancel would sometimes not interrupt current progbar * Revert "fix(progressBar): spamming cancel" This reverts commit b030fddd20f9f2b92a07ce4199c73e3b43f435a3.
40 lines
1.2 KiB
Lua
40 lines
1.2 KiB
Lua
---@alias NotificationPosition 'top' | 'top-right' | 'top-left' | 'bottom' | 'bottom-right' | 'bottom-left' | 'center-right' | 'center-left'
|
|
---@alias NotificationType 'info' | 'warning' | 'success' | 'error'
|
|
|
|
---@class NotifyProps
|
|
---@field id? string
|
|
---@field title? string
|
|
---@field description? string
|
|
---@field duration? number
|
|
---@field position? NotificationPosition
|
|
---@field type? NotificationType
|
|
---@field style? { [string]: any }
|
|
---@field icon? string | {[1]: IconProp, [2]: string};
|
|
---@field iconColor? string;
|
|
|
|
---@param data NotifyProps
|
|
function lib.notify(data)
|
|
SendNUIMessage({
|
|
action = 'notify',
|
|
data = data
|
|
})
|
|
end
|
|
|
|
---@class DefaultNotifyProps
|
|
---@field title? string
|
|
---@field description? string
|
|
---@field duration? number
|
|
---@field position? NotificationPosition
|
|
---@field status? 'info' | 'warning' | 'success' | 'error'
|
|
---@field id? number
|
|
|
|
---@param data DefaultNotifyProps
|
|
function lib.defaultNotify(data)
|
|
-- Backwards compat for v3
|
|
data.type = data.status
|
|
if data.type == 'inform' then data.type = 'info' end
|
|
return lib.notify(data)
|
|
end
|
|
|
|
RegisterNetEvent('ox_lib:notify', lib.notify)
|
|
RegisterNetEvent('ox_lib:defaultNotify', lib.defaultNotify) |