Closing a notification

suggest change

You can close a notification by using the .close() method.

let notification = new Notification(title, options);
// do some work, then close the notification
notification.close()

You can utilize the setTimeout function to auto-close the notification sometime in the future.

let notification = new Notification(title, options);
setTimeout(() => {
    notification.close()
}, 4000);

The above code will spawn a notification and close it after 4 seconds.

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents