From ab5edf33460292721161d90031472132318904d3 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Wed, 27 Dec 2017 10:02:57 +0100 Subject: checks --- public/assets/js/lib/sdk/notification.js | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 public/assets/js/lib/sdk/notification.js (limited to 'public/assets/js/lib/sdk/notification.js') diff --git a/public/assets/js/lib/sdk/notification.js b/public/assets/js/lib/sdk/notification.js new file mode 100644 index 0000000..1ca85e7 --- /dev/null +++ b/public/assets/js/lib/sdk/notification.js @@ -0,0 +1,24 @@ +sdk.notification = (function(){ + + var notification = {} + + notification.request = (cb) => { + Notification.requestPermission().then(function(permission) { + if (permission === "granted") { + + } + }) + } + + notification.notify = (msg) => { + if (Notification.permission === "granted") { + var n = new Notification(msg); + } else if (Notification.permission !== 'denied') { + notification.request(() => { + notification.notify(msg) + }) + } + } + + return notification +})() -- cgit v1.2.3-70-g09d2