tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

simulate-click-handler-sw.js (914B)


      1 // Any copyright is dedicated to the Public Domain.
      2 // http://creativecommons.org/publicdomain/zero/1.0/
      3 //
      4 
      5 /* eslint-env serviceworker */
      6 
      7 onnotificationclick = (e) => {
      8  const {
      9    notification: {
     10      title,
     11      dir,
     12      body,
     13      tag,
     14      icon,
     15      requireInteraction,
     16      silent,
     17      data,
     18      actions,
     19    },
     20    action,
     21  } = e;
     22 
     23  self.clients.matchAll({ includeUncontrolled: true }).then(function (clients) {
     24    if (clients.length === 0) {
     25      dump(
     26        "********************* CLIENTS LIST EMPTY! Test will timeout! ***********************\n"
     27      );
     28      return;
     29    }
     30 
     31    clients.forEach(function (client) {
     32      client.postMessage({
     33        notification: {
     34          title,
     35          dir,
     36          body,
     37          tag,
     38          icon,
     39          requireInteraction,
     40          silent,
     41          data,
     42          actions
     43        },
     44        action,
     45      });
     46    });
     47  })
     48 };