electron/spec/fixtures/workers/load_worker.html

15 lines
321 B
HTML
Raw Normal View History

<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>