browser notifications

HTML5 has brought with it the Notification API. In other words, HTML5 allow us to show browser notifications to the web app users. The most important feature is that the notification will be displayed regardless of which tab or window is focused.

That being said, personally I want to display a notification only when the source tab is not focused (actually, that’s the desired behavior in most of the cases).
So, how can we display browser notifications only when the tab is not active/focused?