refactor(esx_notify): move sound toggle to config and apply camelCase

This commit is contained in:
RodericAguilar
2025-07-28 11:54:56 +02:00
parent 6cae839f8f
commit cd0874dc6b
4 changed files with 7 additions and 6 deletions
+3
View File
@@ -0,0 +1,3 @@
Config = {}
Config.notificationSoundEnabled = true
+1 -3
View File
@@ -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
+1 -1
View File
@@ -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'
+2 -2
View File
@@ -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)
}