forked from conversejs/converse.js
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
75 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
self.addEventListener('install', function(event) { | ||
event.waitUntil(self.skipWaiting()); | ||
}); | ||
|
||
self.addEventListener('activate', function(event) { | ||
event.waitUntil(self.clients.claim()); | ||
}); | ||
|
||
self.addEventListener('push', function(event) { | ||
const payload = event.data ? event.data.json() : null; | ||
|
||
// Keep the service worker alive until the notification is created. | ||
event.waitUntil( | ||
self.registration.showNotification("Converse XMPP notification", { | ||
body: "body", | ||
tag: "tag", | ||
requireInteraction: true, | ||
data: { | ||
a: "b" | ||
} | ||
}) | ||
); | ||
}); |