blob: 0b47d66b65f066fbbf6052c0d3adcdf26706a52c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
importScripts('./dispatcher.js');
const params = new URLSearchParams(location.search);
const uuid = params.get('uuid');
// The fetch handler must be registered before parsing the main script response.
// So do it here, for future use.
fetchHandler = () => {}
addEventListener('fetch', e => {
fetchHandler(e);
});
// Force ServiceWorker to immediately activate itself.
addEventListener('install', event => {
skipWaiting();
});
let executeOrders = async function() {
while(true) {
let task = await receive(uuid);
eval(`(async () => {${task}})()`);
}
};
executeOrders();
|