Skip to content

Instantly share code, notes, and snippets.

@vldvel
Created March 14, 2018 12:40
Show Gist options
  • Save vldvel/eb5393a722048003bdcd7ed074899ab8 to your computer and use it in GitHub Desktop.
Save vldvel/eb5393a722048003bdcd7ed074899ab8 to your computer and use it in GitHub Desktop.
Notification close
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