mirror of
https://github.com/CommunityOx/ox_lib.git
synced 2026-08-17 06:56:03 +01:00
refactor(imports): more type fixes
This commit is contained in:
@@ -33,8 +33,8 @@ local function chatSuggestion(name, parameters, help)
|
|||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
---@param group string
|
---@param group string | string[]
|
||||||
---@param name string
|
---@param name string | string[]
|
||||||
---@param callback function
|
---@param callback function
|
||||||
---@param parameters table
|
---@param parameters table
|
||||||
function lib.addCommand(group, name, callback, parameters, help)
|
function lib.addCommand(group, name, callback, parameters, help)
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ RegisterNetEvent(cbEvent:format(cache.resource), function(key, ...)
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
---@param event string
|
---@param event string
|
||||||
---@param delay number prevent the event from being called for the given time
|
---@param delay number | false prevent the event from being called for the given time
|
||||||
local function eventTimer(event, delay)
|
local function eventTimer(event, delay)
|
||||||
if delay and type(delay) == 'number' and delay > 0 then
|
if delay and type(delay) == 'number' and delay > 0 then
|
||||||
local time = GetGameTimer()
|
local time = GetGameTimer()
|
||||||
@@ -25,7 +25,7 @@ end
|
|||||||
|
|
||||||
---@param _ any
|
---@param _ any
|
||||||
---@param event string
|
---@param event string
|
||||||
---@param delay number
|
---@param delay number | false
|
||||||
---@param cb function|false
|
---@param cb function|false
|
||||||
---@param ... any
|
---@param ... any
|
||||||
---@return unknown?
|
---@return unknown?
|
||||||
@@ -58,13 +58,13 @@ local function triggerServerCallback(_, event, delay, cb, ...)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
---@overload fun(event: string, delay: number, cb: function, ...)
|
---@overload fun(event: string, delay: number | false, cb: function, ...)
|
||||||
lib.callback = setmetatable({}, {
|
lib.callback = setmetatable({}, {
|
||||||
__call = triggerServerCallback
|
__call = triggerServerCallback
|
||||||
})
|
})
|
||||||
|
|
||||||
---@param event string
|
---@param event string
|
||||||
---@param delay number prevent the event from being called for the given time
|
---@param delay number | false prevent the event from being called for the given time
|
||||||
--- Sends an event to the server and halts the current thread until a response is returned.
|
--- Sends an event to the server and halts the current thread until a response is returned.
|
||||||
function lib.callback.await(event, delay, ...)
|
function lib.callback.await(event, delay, ...)
|
||||||
return triggerServerCallback(nil, event, delay, false, ...)
|
return triggerServerCallback(nil, event, delay, false, ...)
|
||||||
|
|||||||
Reference in New Issue
Block a user