Remove common-interface dependency from cryptpad-common
This commit is contained in:
29
www/common/common-notifier.js
Normal file
29
www/common/common-notifier.js
Normal file
@@ -0,0 +1,29 @@
|
||||
define([
|
||||
'/common/visible.js',
|
||||
'/common/notify.js'
|
||||
], function (Visible, Notify) {
|
||||
var Notifier = {};
|
||||
|
||||
var notify = {};
|
||||
Notifier.unnotify = function () {
|
||||
if (notify.tabNotification &&
|
||||
typeof(notify.tabNotification.cancel) === 'function') {
|
||||
notify.tabNotification.cancel();
|
||||
}
|
||||
};
|
||||
|
||||
Notifier.notify = function () {
|
||||
if (Visible.isSupported() && !Visible.currently()) {
|
||||
Notifier.unnotify();
|
||||
notify.tabNotification = Notify.tab(1000, 10);
|
||||
}
|
||||
};
|
||||
|
||||
if (Visible.isSupported()) {
|
||||
Visible.onChange(function (yes) {
|
||||
if (yes) { Notifier.unnotify(); }
|
||||
});
|
||||
}
|
||||
|
||||
return Notifier;
|
||||
});
|
||||
Reference in New Issue
Block a user