Add an option to play audio notifications
This commit is contained in:
parent
b9c8b4afbb
commit
bda0430805
5 changed files with 22 additions and 0 deletions
|
@ -12,6 +12,8 @@
|
|||
MESSAGE : 'message'
|
||||
};
|
||||
|
||||
var sound = new Audio('/audio/NewMessage.mp3');
|
||||
|
||||
Whisper.Notifications = new (Backbone.Collection.extend({
|
||||
initialize: function() {
|
||||
this.on('add', _.debounce(this.update.bind(this), 1000));
|
||||
|
@ -35,6 +37,11 @@
|
|||
if (this.length === 0) {
|
||||
return;
|
||||
}
|
||||
var audioNotification = storage.get('audio-notification') || false;
|
||||
if (audioNotification) {
|
||||
sound.play();
|
||||
}
|
||||
|
||||
var setting = storage.get('notification-setting') || 'message';
|
||||
if (setting === SETTINGS.OFF) {
|
||||
return;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue