aboutsummaryrefslogtreecommitdiff
path: root/static/sw.js
diff options
context:
space:
mode:
Diffstat (limited to 'static/sw.js')
-rw-r--r--static/sw.js14
1 files changed, 14 insertions, 0 deletions
diff --git a/static/sw.js b/static/sw.js
new file mode 100644
index 0000000..e778677
--- /dev/null
+++ b/static/sw.js
@@ -0,0 +1,14 @@
+'use strict';
+
+self.addEventListener('notificationclick', function(e) {
+ var notification = e.notification;
+ var primaryKey = notification.data.primaryKey;
+ var action = e.action;
+
+ if (action === 'close') {
+ notification.close();
+ } else {
+ clients.openWindow(permalink);
+ notification.close();
+ }
+});