mirror of
https://github.com/CommunityOx/ox_lib.git
synced 2026-08-18 15:36:02 +01:00
refactor(addKeybind): improve types
This commit is contained in:
@@ -1,12 +1,15 @@
|
|||||||
---@class CKeybind
|
---@class KeybindProps
|
||||||
---@field name string
|
---@field name string
|
||||||
---@field description string
|
---@field description string
|
||||||
---@field defaultKey? string
|
---@field defaultKey? string
|
||||||
---@field currentKey string
|
|
||||||
---@field disabled? boolean
|
---@field disabled? boolean
|
||||||
---@field disable? fun(self: CKeybind, toggle: boolean)
|
---@field disable? fun(self: CKeybind, toggle: boolean)
|
||||||
---@field onPressed? fun(self: CKeybind)
|
---@field onPressed? fun(self: CKeybind)
|
||||||
---@field onReleased? fun(self: CKeybind)
|
---@field onReleased? fun(self: CKeybind)
|
||||||
|
---@field [string] any
|
||||||
|
|
||||||
|
---@class CKeybind : KeybindProps
|
||||||
|
---@field currentKey string
|
||||||
|
|
||||||
local keybinds = {}
|
local keybinds = {}
|
||||||
|
|
||||||
@@ -16,7 +19,7 @@ end
|
|||||||
|
|
||||||
local IsPauseMenuActive = IsPauseMenuActive
|
local IsPauseMenuActive = IsPauseMenuActive
|
||||||
|
|
||||||
---@param data CKeybind
|
---@param data KeybindProps
|
||||||
---@return CKeybind
|
---@return CKeybind
|
||||||
function lib.addKeybind(data)
|
function lib.addKeybind(data)
|
||||||
data.defaultKey = data.defaultKey or ''
|
data.defaultKey = data.defaultKey or ''
|
||||||
@@ -42,6 +45,7 @@ function lib.addKeybind(data)
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
keybinds[data.name] = data
|
keybinds[data.name] = data
|
||||||
|
---@cast data -KeybindProps
|
||||||
return data
|
return data
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user