Loading src/windows/LocalNotificationCore.js +10 −5 Changes for src/windows/LocalNotificationCore.js: 10 added lines, 5 removed lines. Original line number Diff line number Diff line Loading @@ -62,10 +62,8 @@ exports.core = { notification = this.build(options); this.cancelLocalNotification(options.id); this.scheduleLocalNotification(notification, options); this.scheduleBackupNotification(notification, options); this.fireEvent('schedule', options); this.callOnTrigger(options, triggerFn); } Loading Loading @@ -185,9 +183,10 @@ exports.core = { */ clear: function (ids) { for (var i = 0; i < ids.length; i++) { var notification = this.getAll([id])[0]; var id = ids[i], notification = this.getAll([id])[0]; this.clearLocalNotification(ids[i]); this.clearLocalNotification(id); this.fireEvent('clear', notification); } }, Loading @@ -199,8 +198,13 @@ exports.core = { * Local notification ID */ clearLocalNotification: function (id) { var notification = this.getAll([id])[0]; this.getToastHistory().remove('Toast' + id); if (this.isRepeating(notification)) return; if (this.isTriggered(id) && !this.isScheduled(id)) { this.cancelLocalNotification(id); } Loading Loading @@ -228,7 +232,8 @@ exports.core = { */ cancel: function (ids) { for (var i = 0; i < ids.length; i++) { var notification = this.getAll([id])[0]; var id = ids[i], notification = this.getAll([id])[0]; this.cancelLocalNotification(ids[i]); this.fireEvent('cancel', notification); Loading src/windows/LocalNotificationUtil.js +16 −0 Changes for src/windows/LocalNotificationUtil.js: 16 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -68,6 +68,18 @@ exports.getRepeatInterval = function (every) { return 0; }; /** * If the notification is repeating. * * @param {Object} notification * Local notification object * * @return Boolean */ exports.isRepeating = function (notification) { return this.getRepeatInterval(notification.every) !== 0; }; /** * Parses sound file path. * Loading Loading @@ -363,7 +375,11 @@ WinJS.Application.addEventListener('activated', function (args) { return; exports.clearLocalNotification(id); var repeating = exports.isRepeating(notification); exports.fireEvent('click', notification); exports.fireEvent(repeating ? 'clear' : 'cancel', notification); }, false); // App is running in background Loading Loading
src/windows/LocalNotificationCore.js +10 −5 Changes for src/windows/LocalNotificationCore.js: 10 added lines, 5 removed lines. Original line number Diff line number Diff line Loading @@ -62,10 +62,8 @@ exports.core = { notification = this.build(options); this.cancelLocalNotification(options.id); this.scheduleLocalNotification(notification, options); this.scheduleBackupNotification(notification, options); this.fireEvent('schedule', options); this.callOnTrigger(options, triggerFn); } Loading Loading @@ -185,9 +183,10 @@ exports.core = { */ clear: function (ids) { for (var i = 0; i < ids.length; i++) { var notification = this.getAll([id])[0]; var id = ids[i], notification = this.getAll([id])[0]; this.clearLocalNotification(ids[i]); this.clearLocalNotification(id); this.fireEvent('clear', notification); } }, Loading @@ -199,8 +198,13 @@ exports.core = { * Local notification ID */ clearLocalNotification: function (id) { var notification = this.getAll([id])[0]; this.getToastHistory().remove('Toast' + id); if (this.isRepeating(notification)) return; if (this.isTriggered(id) && !this.isScheduled(id)) { this.cancelLocalNotification(id); } Loading Loading @@ -228,7 +232,8 @@ exports.core = { */ cancel: function (ids) { for (var i = 0; i < ids.length; i++) { var notification = this.getAll([id])[0]; var id = ids[i], notification = this.getAll([id])[0]; this.cancelLocalNotification(ids[i]); this.fireEvent('cancel', notification); Loading
src/windows/LocalNotificationUtil.js +16 −0 Changes for src/windows/LocalNotificationUtil.js: 16 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -68,6 +68,18 @@ exports.getRepeatInterval = function (every) { return 0; }; /** * If the notification is repeating. * * @param {Object} notification * Local notification object * * @return Boolean */ exports.isRepeating = function (notification) { return this.getRepeatInterval(notification.every) !== 0; }; /** * Parses sound file path. * Loading Loading @@ -363,7 +375,11 @@ WinJS.Application.addEventListener('activated', function (args) { return; exports.clearLocalNotification(id); var repeating = exports.isRepeating(notification); exports.fireEvent('click', notification); exports.fireEvent(repeating ? 'clear' : 'cancel', notification); }, false); // App is running in background Loading