navigate-window-worker.js (644B)
1 addEventListener('message', function(evt) { 2 if (evt.data.type === 'GET_CLIENTS') { 3 clients.matchAll(evt.data.opts).then(function(clientList) { 4 var resultList = clientList.map(function(c) { 5 return { url: c.url, frameType: c.frameType, id: c.id }; 6 }); 7 evt.source.postMessage({ type: 'success', detail: resultList }); 8 }).catch(function(err) { 9 evt.source.postMessage({ 10 type: 'failure', 11 detail: 'matchAll() rejected with "' + err + '"' 12 }); 13 }); 14 return; 15 } 16 17 evt.source.postMessage({ 18 type: 'failure', 19 detail: 'Unexpected message type "' + evt.data.type + '"' 20 }); 21 });