Created
March 14, 2018 07:51
-
-
Save vldvel/286f9af45bd2fa3a686108ad96010b3c to your computer and use it in GitHub Desktop.
Notification request promise
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Notification | |
.requestPermission() | |
.then((permission) => { | |
if (permission !== 'granted') throw new Error('No access!'); | |
}) | |
.then(() => { | |
console.log('We have an access!'); | |
// Handle granted permission here | |
}) | |
.catch((err) => { | |
console.log(err); | |
// Handle denied permission here | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment