Skip to content

Commit

Permalink
refactor(addKeybind): improve types
Browse files Browse the repository at this point in the history
  • Loading branch information
thelindat committed Oct 16, 2022
1 parent 63b8afa commit 5b2c74a
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions imports/addKeybind/client.lua
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
---@class CKeybind
---@class KeybindProps
---@field name string
---@field description string
---@field defaultKey? string
---@field currentKey string
---@field disabled? boolean
---@field disable? fun(self: CKeybind, toggle: boolean)
---@field onPressed? fun(self: CKeybind)
---@field onReleased? fun(self: CKeybind)
---@field [string] any

---@class CKeybind : KeybindProps
---@field currentKey string

local keybinds = {}

Expand All @@ -16,7 +19,7 @@ end

local IsPauseMenuActive = IsPauseMenuActive

---@param data CKeybind
---@param data KeybindProps
---@return CKeybind
function lib.addKeybind(data)
data.defaultKey = data.defaultKey or ''
Expand All @@ -42,6 +45,7 @@ function lib.addKeybind(data)
end)

keybinds[data.name] = data
---@cast data -KeybindProps
return data
end

Expand Down

0 comments on commit 5b2c74a

Please sign in to comment.