mirror of
https://github.com/esx-framework/esx_core.git
synced 2026-08-29 09:18:53 +00:00
Merge pull request #1687 from esx-framework/feat-notification-sound
feat(esx_notify): add toggle for notification sound playback
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
Config = {}
|
||||
|
||||
Config.notificationSoundEnabled = true
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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'
|
||||
|
||||
|
||||
@@ -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%")
|
||||
|
||||
Reference in New Issue
Block a user