Skip to content

Commit

Permalink
feat(web/context): Get open context menu function
Browse files Browse the repository at this point in the history
  • Loading branch information
LukeWasTakenn committed Apr 15, 2022
1 parent 65a5bab commit 50b1ddd
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions resource/interface/client/context.lua
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
local contextMenus = {}
local openContextMenu = nil

function lib.showContext(id)
local data = contextMenus[id]
openContextMenu = id
SetNuiFocus(true, true)
SendNUIMessage({
action = 'showContext',
Expand All @@ -24,6 +26,8 @@ function lib.registerContext(context)
end
end

function lib.getOpenContextMenu() return openContextMenu end

RegisterNUICallback('openContext', function(id, cb)
cb(1)
lib.showContext(id)
Expand All @@ -33,6 +37,7 @@ RegisterNUICallback('clickContext', function(data, cb)
cb(1)
if data.event then TriggerEvent(data.event, data.args) end
if data.serverEvent then TriggerServerEvent(data.serverEvent, data.args) end
openContextMenu = nil
SetNuiFocus(false, false)
SendNUIMessage({
action = 'hideContext'
Expand Down

0 comments on commit 50b1ddd

Please sign in to comment.