2022-09-18 09:06:32 +10:00
|
|
|
---@alias NotificationPosition 'top' | 'top-right' | 'top-left' | 'bottom' | 'bottom-right' | 'bottom-left'
|
|
|
|
|
---@alias NotificationType 'inform' | 'error' | 'success'
|
2022-04-16 12:03:50 +02:00
|
|
|
|
2022-09-18 09:06:32 +10:00
|
|
|
---@class NotifyProps
|
|
|
|
|
---@field id? string
|
|
|
|
|
---@field title? string
|
|
|
|
|
---@field description? string
|
|
|
|
|
---@field duration? number
|
|
|
|
|
---@field position? NotificationPosition
|
|
|
|
|
---@field type? NotificationType
|
2022-10-02 20:19:35 +11:00
|
|
|
---@field style? { [string]: any }
|
2022-09-18 09:06:32 +10:00
|
|
|
---@field icon? string;
|
|
|
|
|
---@field iconColor? string;
|
|
|
|
|
|
|
|
|
|
---@param data NotifyProps
|
2022-04-11 03:52:18 +00:00
|
|
|
function lib.notify(data)
|
2022-09-18 09:06:32 +10:00
|
|
|
SendNUIMessage({
|
|
|
|
|
action = 'customNotify',
|
|
|
|
|
data = data
|
|
|
|
|
})
|
2022-04-11 03:52:18 +00:00
|
|
|
end
|
2022-04-11 04:59:21 +00:00
|
|
|
|
2022-09-18 09:06:32 +10:00
|
|
|
---@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
|
2022-04-16 12:03:50 +02:00
|
|
|
function lib.defaultNotify(data)
|
2022-09-18 09:06:32 +10:00
|
|
|
SendNUIMessage({
|
|
|
|
|
action = 'notify',
|
|
|
|
|
data = data
|
|
|
|
|
})
|
2022-04-16 12:03:50 +02:00
|
|
|
end
|
|
|
|
|
|
2022-04-11 04:59:21 +00:00
|
|
|
RegisterNetEvent('ox_lib:notify', lib.notify)
|
2022-09-18 09:06:32 +10:00
|
|
|
RegisterNetEvent('ox_lib:defaultNotify', lib.defaultNotify)
|