mirror of
https://github.com/roytam1/UXP.git
synced 2026-05-27 21:38:34 +00:00
33 lines
752 B
HTML
33 lines
752 B
HTML
<!DOCTYPE HTML>
|
|
<html>
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<title>Service worker push test</title>
|
|
</head>
|
|
<body>
|
|
<script type="text/javascript">
|
|
"use strict";
|
|
SpecialPowers.addPermission("desktop-notification", true, document);
|
|
var sw = navigator.serviceWorker.register("push-sw.js");
|
|
var sub = null;
|
|
sw.then(
|
|
function (registration) {
|
|
dump("SW registered\n");
|
|
registration.pushManager.subscribe().then(
|
|
function (subscription) {
|
|
sub = subscription;
|
|
dump("SW subscribed to push: " + sub.endpoint + "\n");
|
|
},
|
|
function (error) {
|
|
dump("SW not subscribed to push: " + error + "\n");
|
|
}
|
|
);
|
|
},
|
|
function (error) {
|
|
dump("SW not registered: " + error + "\n");
|
|
}
|
|
);
|
|
</script>
|
|
</body>
|
|
</html>
|