mirror of
https://github.com/CommunityOx/ox_lib.git
synced 2026-08-17 06:56:03 +01:00
feat(resource/interface): export notify
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
local contextMenus = {}
|
||||
|
||||
local function showContext(id)
|
||||
function lib.showContext(id)
|
||||
local data = contextMenus[id]
|
||||
SetNuiFocus(true, true)
|
||||
SendNUIMessage({
|
||||
@@ -13,7 +13,7 @@ local function showContext(id)
|
||||
})
|
||||
end
|
||||
|
||||
local function registerContext(context)
|
||||
function lib.registerContext(context)
|
||||
for k, v in pairs(context) do
|
||||
if type(k) == 'number' then
|
||||
contextMenus[v.id] = v
|
||||
@@ -25,7 +25,7 @@ local function registerContext(context)
|
||||
end
|
||||
|
||||
RegisterNUICallback('openContext', function(id)
|
||||
showContext(id)
|
||||
lib.showContext(id)
|
||||
end)
|
||||
|
||||
RegisterNUICallback('clickContext', function(data)
|
||||
19
resource/interface/client/notify.lua
Normal file
19
resource/interface/client/notify.lua
Normal file
@@ -0,0 +1,19 @@
|
||||
--[[```lua
|
||||
{
|
||||
id?: string
|
||||
title?: string
|
||||
description: string
|
||||
duration?: number
|
||||
position?: 'top' | 'top-right' | 'top-left' | 'bottom' | 'bottom-right' | 'bottom-left'
|
||||
style?: table
|
||||
icon?: string
|
||||
iconColor?: string
|
||||
}
|
||||
```]]
|
||||
---@param data table
|
||||
function lib.notify(data)
|
||||
SendNUIMessage({
|
||||
action = 'customNotify',
|
||||
data = data
|
||||
})
|
||||
end
|
||||
Reference in New Issue
Block a user