blob: 56f8a6ffe822ecb8fa0d042cc4c246a3c623f8c6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
const import_url = './export-referrer-checker.py';
if ('DedicatedWorkerGlobalScope' in self &&
self instanceof DedicatedWorkerGlobalScope) {
import(import_url)
.then(module => postMessage(module.referrer))
.catch(error => postMessage(`Import failed: ${error}`));
} else if (
'SharedWorkerGlobalScope' in self &&
self instanceof SharedWorkerGlobalScope) {
onconnect = e => {
import(import_url)
.then(module => e.ports[0].postMessage(module.referrer))
.catch(error => e.ports[0].postMessage(`Import failed: ${error}`));
};
}
|