From d7500b363fee49307304fa623f74649cb408b532 Mon Sep 17 00:00:00 2001 From: Mantas <11616378+mistermantas@users.noreply.github.com> Date: Wed, 11 Jul 2018 14:45:50 +0300 Subject: v2-dev2 --- static/sw.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 static/sw.js (limited to 'static/sw.js') 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(); + } +}); -- cgit v1.2.3-70-g09d2