diff options
| author | Jules Laplace <julescarbon@gmail.com> | 2017-12-27 10:02:57 +0100 |
|---|---|---|
| committer | Jules Laplace <julescarbon@gmail.com> | 2017-12-27 10:02:57 +0100 |
| commit | ab5edf33460292721161d90031472132318904d3 (patch) | |
| tree | 326b45f53e6f25d73d83c10943c413737e7bdf61 /public/assets/js/lib/sdk/notification.js | |
| parent | b6777c92daf6e2becfb0efb3316a05885ce18109 (diff) | |
checks
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 +})() |
