Browse Source

Focus the tab when clicking on a notification

master
yflory 1 year ago
parent
commit
d9e7fc24fe
1 changed files with 10 additions and 1 deletions
  1. 11
      www/common/notify.js

11
www/common/notify.js

@ -30,10 +30,19 @@ define(['/api/config'], function (ApiConfig) {
icon = DEFAULT_ALT;
}
return new Notification(title,{
var n = new Notification(title,{
icon: icon,
body: msg,
});
n.onclick = function () {
if (!document) { return; }
try {
parent.focus();
window.focus(); //just in case, older browsers
this.close();
} catch (e) {}
};
return n;
};
Module.system = function (msg, title, icon) {

Loading…
Cancel
Save