Merge pull request #1687 from esx-framework/feat-notification-sound

feat(esx_notify): add toggle for notification sound playback
This commit is contained in:
Kenshin13
2025-07-28 13:51:08 +02:00
committed by GitHub
4 changed files with 12 additions and 3 deletions
+3
View File
@@ -0,0 +1,3 @@
Config = {}
Config.notificationSoundEnabled = true
+3 -1
View File
@@ -1,5 +1,6 @@
local Debug = ESX.GetConfig().EnableDebug
---@param notificatonType string the notification type
---@param length number the length of the notification
---@param message any the message :D
@@ -35,7 +36,8 @@ local function Notify(notificatonType, length, message, title)
type = notificatonType or "info",
length = length or 5000,
message = message or "ESX-Notify",
title = title or "New Notification"
title = title or "New Notification",
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 { 'Config.lua', 'Notify.lua'}
ui_page 'nui/index.html'
+5 -1
View File
@@ -83,6 +83,7 @@ w.addEventListener("message", (event) => {
title: event.data.title || "New Notification",
message: event.data.message,
length: event.data.length,
notificationSoundEnabled: event.data.notificationSoundEnabled,
})
})
@@ -173,7 +174,10 @@ const notification = (data) => {
width: "0%",
})
playNotificationSound(data.type)
if (data.notificationSoundEnabled) {
playNotificationSound(data.type)
}
setTimeout(() => {
$(`#${id} .notify-progress`).css("width", "100%")