nl_tokens: Displays the web notification and returning a hide notification function .
pl_tokens: function ( title , options , callback ) { var autoClose = 0 ; if ( options . autoClose && ( typeof options . autoClose === 'number' ) ) { autoClose = options . autoClose ; } //defaults the notification icon to the website favicon.ico if ( ! options . icon ) { options . icon = '/favicon.ico' ; } var onNotification = function ( notification ) { //add onclick handler if ( options . onClick && notification ) { notification . onclick = options . onClick ; } var hideNotification = function ( ) { notification . close ( ) ; } ; if ( autoClose ) { setTimeout ( hideNotification , autoClose ) ; } callback ( null , hideNotification ) ; } ; var serviceWorkerRegistration = options . serviceWorkerRegistration ; if ( serviceWorkerRegistration ) { delete options . serviceWorkerRegistration ; if ( ! options . tag ) { tagCounter ++ ; options . tag = 'webnotification-' + Date . now ( ) + '-' + tagCounter ; } var tag = options . tag ; serviceWorkerRegistration . showNotification ( title , options ) . then ( function onCreate ( ) { serviceWorkerRegistration . getNotifications ( { tag : tag } ) . then ( function notificationsFetched ( notifications ) { if ( notifications && notifications . length ) { onNotification ( notifications [ 0 ] ) ; } else { <mask> ( new Error ( 'Unable to find notification.' ) ) ; } } ) . catch ( callback ) ; } ) . catch ( callback ) ; } else { var instance ; try { instance = new NotificationAPI ( title , options ) ; } catch ( error ) { callback ( error ) ; } //in case of no errors if ( instance ) { onNotification ( instance ) ; } } }