LISTEN FOR DESKTOP NOTIFICATION EVENTS

You can define custom JavaScript callback functions at specific events to be executed as the Desktop Notifications API interacts with the user. There are four events in the Notification interface for which you can listen:

notifyMessage.ondisplay = function() { ... };
notifyMessage.onclick = function() { ... };
notifyMessage.onclose = function() { ... };
notifyMessage.onerror = function() { ... };

The ondisplay event is called whenever the notification message is actually displayed on the desktop after calling show() . This will allow you to know if a delay occurred caused by too many messages on-screen.

The onclick event is called whenever the user clicks the message itself. It is a good idea to call ...

Get HTML5: Your visual blueprint™ for designing rich web pages and applications now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.