aboutsummaryrefslogtreecommitdiff
path: root/static/sw.js
diff options
context:
space:
mode:
authorMantas <11616378+mistermantas@users.noreply.github.com>2018-07-11 14:45:50 +0300
committerMantas <11616378+mistermantas@users.noreply.github.com>2018-07-11 14:45:50 +0300
commitd7500b363fee49307304fa623f74649cb408b532 (patch)
tree1413e689d5c006ab80e251816d595bfa74ab65a0 /static/sw.js
parent7061d2290b01c0d875b2e581bd4254b485ef48ed (diff)
v2-dev2
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();
+ }
+});