Created
March 14, 2018 12:40
-
-
Save vldvel/eb5393a722048003bdcd7ed074899ab8 to your computer and use it in GitHub Desktop.
Notification close
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
const notificationProps = { | |
title: 'I\'m notification', | |
body: 'Here is my desription', | |
icon: 'https://avatars1.githubusercontent.com/u/22643415', | |
vibrate: [50, 100, 150] | |
} | |
const myNotification = new Notification(notificationProps.title, notificationProps); | |
function closeNotification(notifyID, time) { | |
if (notifyID instanceof Notification) { | |
setTimeout(() => { | |
notifyID.close(); | |
}, time); | |
} | |
} | |
closeNotification(myNotification, 600); // close notification after 600ms |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment