blob: b51c4517509470ce5f2940b1ac64242d65885ec2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
<!doctype html>
<script>
const workerUrl = '../out-of-scope/sample-synthesized-worker.js?dedicated';
const worker = new Worker(workerUrl);
const workerPromise = new Promise(resolve => {
worker.onmessage = e => {
// `e.data` is 'worker loading intercepted by service worker' when a worker
// is intercepted by a service worker.
resolve(e.data);
}
worker.onerror = _ => {
resolve('worker loading was not intercepted by service worker');
}
});
function getWorkerPromise() {
return workerPromise;
}
</script>
|