refactor(resource/interface): formatting and type definitions

This commit is contained in:
Linden
2022-09-18 09:06:32 +10:00
parent cb645ae345
commit 6254ba9ba2
8 changed files with 388 additions and 265 deletions

View File

@@ -1,32 +1,40 @@
--[[```lua
{
id?: string
title?: string
description: string
duration?: number
position?: 'top' | 'top-right' | 'top-left' | 'bottom' | 'bottom-right' | 'bottom-left'
style?: table
icon?: string
iconColor?: string
}
```]]
---@alias NotificationPosition 'top' | 'top-right' | 'top-left' | 'bottom' | 'bottom-right' | 'bottom-left'
---@alias NotificationType 'inform' | 'error' | 'success'
-- Custom notifications with a lot of allowed styling
---@param data table
---@class NotifyProps
---@field id? string
---@field title? string
---@field description? string
---@field duration? number
---@field position? NotificationPosition
---@field type? NotificationType
---@field style? string
---@field icon? string;
---@field iconColor? string;
---@param data NotifyProps
function lib.notify(data)
SendNUIMessage({
action = 'customNotify',
data = data
})
SendNUIMessage({
action = 'customNotify',
data = data
})
end
-- Default Chakra UI notifications
---@class DefaultNotifyProps
---@field title? string
---@field description? string
---@field duration? number
---@field position? NotificationPosition
---@field status? 'info' | 'warning' | 'success' | 'error'
---@field id? number
---@param data DefaultNotifyProps
function lib.defaultNotify(data)
SendNUIMessage({
action = 'notify',
data = data
})
SendNUIMessage({
action = 'notify',
data = data
})
end
RegisterNetEvent('ox_lib:notify', lib.notify)
RegisterNetEvent('ox_lib:defaultNotify', lib.defaultNotify)
RegisterNetEvent('ox_lib:defaultNotify', lib.defaultNotify)