Created
March 14, 2018 13:18
-
-
Save vldvel/9ead7bc71af65de3c75a4d06a5455fbd to your computer and use it in GitHub Desktop.
Notification permission
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
switch (Notification.permission) { | |
case 'granted': { | |
new Notification('Hello world!'); | |
break; | |
} | |
case 'denied': { | |
alert('No notification for you!'); | |
break; | |
} | |
case 'default': { | |
Notification.requestPermission(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment