Unwanted iPhone sound has been fixed / removed in a recent node-webkit pull request and released.
As for creating my own sounds, I use a wrapper around the source notification object so that whenever I call the show show command, I also play a sound if necessary.
function NotificationWrapper(appIcon, title, description, soundFile) { function playSound(soundFile) { if(soundFile === undefined) return; var audio = document.createElement('audio'); audio.src = soundFile; audio.play(); audio = undefined; } var notification = new window.Notification(title, { body: description, icon: appIcon }); playSound(soundFile); return notification; }
To use it, we simply call it using the new keyword:
var myNotification = new NotificationWrapper( '#', // image icon path goes here 'node-webkit is awesome', 'Especially now that I can use my own sounds', '/sounds/notification.wav' ); myNotification.addEventListener('click', function() { console.log('You clicked the notification.'); });
jmort253
source share