mirror of
https://github.com/CommunityOx/ox_lib.git
synced 2026-08-17 06:56:03 +01:00
refactor(client/interface): default notify backwards compat
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
---@alias NotificationPosition 'top' | 'top-right' | 'top-left' | 'bottom' | 'bottom-right' | 'bottom-left'
|
||||
---@alias NotificationPosition 'top' | 'top-right' | 'top-left' | 'bottom' | 'bottom-right' | 'bottom-left' | 'center-right' | 'center-left'
|
||||
---@alias NotificationType 'inform' | 'error' | 'success'
|
||||
|
||||
---@class NotifyProps
|
||||
@@ -15,7 +15,7 @@
|
||||
---@param data NotifyProps
|
||||
function lib.notify(data)
|
||||
SendNUIMessage({
|
||||
action = 'customNotify',
|
||||
action = 'notify',
|
||||
data = data
|
||||
})
|
||||
end
|
||||
@@ -30,10 +30,10 @@ end
|
||||
|
||||
---@param data DefaultNotifyProps
|
||||
function lib.defaultNotify(data)
|
||||
SendNUIMessage({
|
||||
action = 'notify',
|
||||
data = data
|
||||
})
|
||||
-- Backwards compat for v3
|
||||
data.type = data.status
|
||||
if data.type == 'info' or data.type == 'warning' then data.type = 'inform' end
|
||||
return lib.notify(data)
|
||||
end
|
||||
|
||||
RegisterNetEvent('ox_lib:notify', lib.notify)
|
||||
|
||||
Reference in New Issue
Block a user