mirror of
https://github.com/electron/electron.git
synced 2026-01-14 01:48:14 -05:00
15 lines
321 B
HTML
15 lines
321 B
HTML
<script>
|
|
function loadWorker(url) {
|
|
return new Promise((resolve) => {
|
|
try {
|
|
const w = new Worker(url);
|
|
w.onerror = () => resolve('failed');
|
|
w.onmessage = (m) => resolve(m.data);
|
|
w.postMessage('success');
|
|
} catch {
|
|
resolve('failed');
|
|
}
|
|
});
|
|
}
|
|
</script>
|