chore(intellisense): improve parameter annotations and add missing comments
Touched up incorrect or missing Intellisense parameter annotations across several functions. Added some missing descriptions to improve editor support. Still more to do, but this is a small step forward for overall developer workflow. Also small fix in picklexp
This commit is contained in:
1 parent
866283162b
commit
c71a261115
88 files changed
+339
-286
No files matched your search
+5
-92
@@ -1,7 +1,7 @@
|
||||
Menus = Menus or {}
|
||||
Menu = {}
|
||||
|
||||
--- Opens a menu based on the configuration.
|
||||
---Opens a menu based on the configuration.
|
||||
---@param data table The menu data.
|
||||
---@param useQb boolean Whether to use QB menu syntax.
|
||||
---@return id string The menu ID.
|
||||
@@ -12,9 +12,9 @@ function Menu.Open(data, useQb)
|
||||
return id
|
||||
end
|
||||
|
||||
--- Event to handle callback from menu selection.
|
||||
--- @param _args table The arguments passed to the callback.
|
||||
--- @return nil
|
||||
---Event to handle callback from menu selection.
|
||||
---@param _args table The arguments passed to the callback.
|
||||
---@return nil
|
||||
RegisterNetEvent('community_bridge:client:MenuCallback', function(_args)
|
||||
local id = _args.id
|
||||
local onSelect = _args.onSelect
|
||||
@@ -23,91 +23,4 @@ RegisterNetEvent('community_bridge:client:MenuCallback', function(_args)
|
||||
onSelect(args)
|
||||
end)
|
||||
|
||||
return Menu
|
||||
|
||||
--[[
|
||||
|
||||
--Unit Tests
|
||||
local qbMenu = {
|
||||
{
|
||||
header = 'QBCore Test Menu',
|
||||
icon = 'fas fa-code',
|
||||
isMenuHeader = true, -- Set to true to make a nonclickable title
|
||||
},
|
||||
{
|
||||
header = 'First Button',
|
||||
txt = 'Open a secondary menu!',
|
||||
icon = 'fas fa-code-pull-request',
|
||||
-- disabled = false, -- optional, non-clickable and grey scale
|
||||
-- hidden = true, -- optional, hides the button completely
|
||||
params = {
|
||||
-- isServer = false, -- optional, specify event type
|
||||
event = 'community_bridge:client:TestEvent',
|
||||
args = {
|
||||
number = 1,
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
header = 'Second Button',
|
||||
txt = 'Open a secondary menu!',
|
||||
icon = 'fas fa-code-pull-request',
|
||||
params = {
|
||||
event = 'community_bridge:client:TestEvent',
|
||||
args = {
|
||||
number = 2,
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
local oxMenu = {
|
||||
id = "test",
|
||||
title = "Test Menu",
|
||||
options = {
|
||||
{
|
||||
title = "First Button",
|
||||
description = "Open a secondary menu!",
|
||||
icon = "fas fa-code-pull-request",
|
||||
args = {
|
||||
number = 1,
|
||||
},
|
||||
onSelect = function(selected, secondary, args)
|
||||
print("Selected", json.encode(selected))
|
||||
end
|
||||
},
|
||||
{
|
||||
title = "Second Button",
|
||||
description = "Open a secondary menu!",
|
||||
icon = "fas fa-code-pull-request",
|
||||
args = {
|
||||
number = 2,
|
||||
},
|
||||
onSelect = function(selected, secondary, args)
|
||||
print("Selected", json.encode(selected))
|
||||
end
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
RegisterCommand("testmenu-qbtoox", function()
|
||||
Menu.Open(qbMenu, true)
|
||||
end)
|
||||
|
||||
RegisterCommand("testmenu-oxtoqb", function()
|
||||
Menu.Open(oxMenu, false)
|
||||
end)
|
||||
|
||||
RegisterCommand("testmenu-oxtoox", function()
|
||||
Menu.Open(oxMenu, false)
|
||||
end)
|
||||
|
||||
RegisterCommand("testmenu-qbtoqb", function()
|
||||
Menu.Open(qbMenu, true)
|
||||
end)
|
||||
|
||||
RegisterNetEvent('community_bridge:client:TestEvent', function(args)
|
||||
print("Test Event", json.encode(args))
|
||||
end)
|
||||
|
||||
--]]
|
||||
return Menu
|
||||
Reference in new issue
Block a user