VulpesOS/assets/webapps/network-alerts.gaiamobile.org/js/notification/notification.js
OverSu b38dea0597 Publish Vulpes Preview 15 sources for desktop, Android and Tundra
Share Gaia assets and adapters, keep private profiles and development documents local, and update both public READMEs.
2026-09-30 23:13:03 +02:00

36 lines
579 B
JavaScript

'use strict';
(function(exports) {
function init() {
window.navigator.mozSetMessageHandler('notification', onNotification);
}
function closeWindow() {
window.close();
}
function onNotification(message) {
if (!message.clicked) {
closeWindow();
return;
}
var title = message.data.title;
var url = [
'attention.html?title=',
encodeURIComponent(title),
'&body=',
encodeURIComponent(message.body),
'&notification=1'
].join('');
window.open(url, '_blank', 'attention');
}
exports.NotificationHandler = {
init: init
};
})(window);