mirror of
https://github.com/nextcloud/passman.git
synced 2024-11-15 12:32:46 +08:00
29 lines
703 B
JavaScript
29 lines
703 B
JavaScript
'use strict';
|
|
|
|
/**
|
|
* @ngdoc service
|
|
* @name passmanApp.NotificationService
|
|
* @description
|
|
* # NotificationService
|
|
* Service in the passmanApp.
|
|
*/
|
|
angular.module('passmanApp')
|
|
.service('NotificationService', ['$timeout', function ($timeout) {
|
|
var to ;
|
|
return {
|
|
showNotification: function (text, time, closeCallback) {
|
|
var notification = OC.Notification.showHtml(text);
|
|
to =$timeout(function () {
|
|
OC.Notification.hide(notification, closeCallback)
|
|
}, time);
|
|
return notification;
|
|
},
|
|
hideNotification: function (notification) {
|
|
$timeout.cancel(to);
|
|
OC.Notification.hide(notification)
|
|
},
|
|
hideAll: function () {
|
|
OC.Notification.hide();
|
|
}
|
|
}
|
|
}]);
|