Enable browser notifications for messaging tools
This commit is contained in:
@@ -12,13 +12,25 @@ define([
|
||||
}
|
||||
};
|
||||
|
||||
Notifier.notify = function () {
|
||||
Notifier.notify = function (data) {
|
||||
if (Visible.isSupported() && !Visible.currently()) {
|
||||
if (data) {
|
||||
var title = data.title;
|
||||
if (document.title) { title += ' (' + document.title + ')'; }
|
||||
Notify.system(data.msg, title);
|
||||
return;
|
||||
}
|
||||
Notifier.unnotify();
|
||||
notify.tabNotification = Notify.tab(1000, 10);
|
||||
}
|
||||
};
|
||||
|
||||
Notifier.getPermission = function () {
|
||||
if (Notify.isSupported()) {
|
||||
Notify.getPermission();
|
||||
}
|
||||
};
|
||||
|
||||
if (Visible.isSupported()) {
|
||||
Visible.onChange(function (yes) {
|
||||
if (yes) { Notifier.unnotify(); }
|
||||
|
||||
Reference in New Issue
Block a user