Edit in JSFiddle

var notif,
    options = {
        dir: 'rtl',
        lang: 'en',
        body: 'No tags \'till Brooklyn',
        tag: 'justatestid',
        icon: 'http://lorempixel.com/140/140/'    
    };

if ( Notification.permission === 'default' ) {
    Notification.requestPermission( function(status) {
      notify ();
    });
}
else if ( Notification.permission === 'granted' ) {
    notify ();
}

function notify () {
    // Create new notification
    notif = new Notification("Hello kitty", options);
    
    // Close after 5 seconds
    notif.onshow = function () { 
      setTimeout(notif.close.bind(notif), 5000); 
    }
}