diff options
Diffstat (limited to 'webclient/components/matrix/notification-service.js')
-rw-r--r-- | webclient/components/matrix/notification-service.js | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/webclient/components/matrix/notification-service.js b/webclient/components/matrix/notification-service.js index 7821248846..9a911413c3 100644 --- a/webclient/components/matrix/notification-service.js +++ b/webclient/components/matrix/notification-service.js @@ -21,7 +21,7 @@ This service manages notifications: enabling, creating and showing them. This also contains 'bing word' logic. */ angular.module('notificationService', []) -.factory('notificationService', function($rootScope) { +.factory('notificationService', ['$timeout', function($timeout) { var getLocalPartFromUserId = function(user_id) { if (!user_id) { @@ -80,7 +80,25 @@ angular.module('notificationService', []) } } return false; + }, + + showNotification: function(title, body, icon, onclick) { + var notification = new window.Notification( + title, + { + "body": body, + "icon": icon + } + ); + + if (onclick) { + notification.onclick = onclick; + } + + $timeout(function() { + notification.close(); + }, 5 * 1000); } }; -}); +}]); |