diff options
Diffstat (limited to 'public/assets/js/lib/sdk/notification.js')
| -rw-r--r-- | public/assets/js/lib/sdk/notification.js | 24 |
1 files changed, 24 insertions, 0 deletions
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 +})() |
