15 lines
344 B
HTML
15 lines
344 B
HTML
<script>
|
|
function loadSharedWorker(url) {
|
|
return new Promise((resolve) => {
|
|
try {
|
|
const w = new SharedWorker(url);
|
|
w.onerror = () => resolve('failed');
|
|
w.port.onmessage = (m) => resolve(m.data);
|
|
w.port.postMessage('success');
|
|
} catch {
|
|
resolve('failed');
|
|
}
|
|
});
|
|
}
|
|
</script>
|
|
|