mirror of
https://github.com/esx-framework/esx_core.git
synced 2026-08-29 01:08:54 +00:00
refactor(esx_notify): move sound toggle to config and apply camelCase
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
Config = {}
|
||||
|
||||
Config.notificationSoundEnabled = true
|
||||
@@ -1,7 +1,5 @@
|
||||
local Debug = ESX.GetConfig().EnableDebug
|
||||
|
||||
---@type boolean Whether the notification sound should be played.
|
||||
local NotificationSoundEnabled = true
|
||||
|
||||
---@param notificatonType string the notification type
|
||||
---@param length number the length of the notification
|
||||
@@ -39,7 +37,7 @@ local function Notify(notificatonType, length, message, title)
|
||||
length = length or 5000,
|
||||
message = message or "ESX-Notify",
|
||||
title = title or "New Notification",
|
||||
NotificationSoundEnabled = NotificationSoundEnabled
|
||||
notificationSoundEnabled = Config.notificationSoundEnabled
|
||||
}))
|
||||
end
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ description 'A beautiful and simple NUI notification system for ESX'
|
||||
|
||||
shared_script '@es_extended/imports.lua'
|
||||
|
||||
client_scripts { 'Notify.lua' }
|
||||
client_scripts { 'Notify.lua', 'Config.lua'}
|
||||
|
||||
ui_page 'nui/index.html'
|
||||
|
||||
|
||||
@@ -83,7 +83,7 @@ w.addEventListener("message", (event) => {
|
||||
title: event.data.title || "New Notification",
|
||||
message: event.data.message,
|
||||
length: event.data.length,
|
||||
NotificationSoundEnabled: event.data.NotificationSoundEnabled,
|
||||
notificationSoundEnabled: event.data.notificationSoundEnabled,
|
||||
})
|
||||
})
|
||||
|
||||
@@ -174,7 +174,7 @@ const notification = (data) => {
|
||||
width: "0%",
|
||||
})
|
||||
|
||||
if (data.NotificationSoundEnabled) {
|
||||
if (data.notificationSoundEnabled) {
|
||||
playNotificationSound(data.type)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user