dist/sw/sw.js
function notificationClickListener(event) {
    console.log('Leanplum: [Service Worker] Notification click received.');

    event.notification.close();

    if (!event.notification || !event.notification.tag) {
      console.log('Leanplum: No notification or tag/id received, skipping open action.');
      return;
    }

    var notificationId = event.notification.tag;
    var openActionUrl = openActions[notificationId];
    if (!openActionUrl) {
      console.log('Leanplum: [Service Worker] No action defined, doing nothing.');
      return;
    }

    Reflect.deleteProperty(openActions, 'notificationId');

    /** @namespace clients.openWindow **/
    event.waitUntil(clients.openWindow(openActionUrl));
  }
function notificationClickListener(event) {
    console.log('Leanplum: [Service Worker] Notification click received.');

    event.notification.close();

    if (!event.notification || !event.notification.tag) {
      console.log('Leanplum: No notification or tag/id received, skipping open action.');
      return;
    }

    var notificationId = event.notification.tag;
    var openActionUrl = openActions[notificationId];
    if (!openActionUrl) {
      console.log('Leanplum: [Service Worker] No action defined, doing nothing.');
      return;
    }

    Reflect.deleteProperty(openActions, 'notificationId');

    /** @namespace clients.openWindow **/
    event.waitUntil(clients.openWindow(openActionUrl));
  }
function notificationClickListener ( event ) { console . log ( 'Leanplum: [Service Worker] Notification click received.' ) ; event . notification . close ( ) ; if ( ! event . notification || ! event . notification . tag ) { console . log ( 'Leanplum: No notification or tag/id received, skipping open action.' ) ; return ; } var notificationId = event . notification . tag ; var openActionUrl = openActions [ notificationId ] ; if ( ! openActionUrl ) { console . log ( 'Leanplum: [Service Worker] No action defined, doing nothing.' ) ; return ; } Reflect . deleteProperty ( openActions , 'notificationId' ) ; /** @namespace clients.openWindow **/ event . waitUntil ( clients . openWindow ( openActionUrl ) ) ; }
Callback that handles clicks on the notification.
@param {object} event The notification event object.
@param {object} event.notification The notification object.
@param {function} event.waitUntil The browser will keep the service worker running until the
promise you passed in has settled.
Callback that handles clicks on the notification .