Last active
June 11, 2020 03:37
-
-
Save developit/5b09dc86c644d76f8fbd8abe294440f2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var s; | |
function supportsModuleWorkers() { | |
if (s==null) { | |
s = false; | |
try { | |
new Worker('data:,', Object.defineProperty({}, 'type', { | |
get() { s = true; } | |
})).terminate(); | |
} catch (e) {} | |
} | |
return s; | |
} |
Changing line 8 to this seems to do the trick: })).terminate();
Good suggestion @dasa! I've added it.
As a pure func?
function supportsModuleWorkers() {
let s = false;
try {
new Worker('data:,', Object.defineProperty({}, 'type', {
get() { s = true; }
})).terminate();
} catch (e) {}
return s;
}
Typo in teminate
.
Typo in
teminate
.
Thanks!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Nice, but Firefox shows this console warning:
Attempting to create a Worker from an empty source. This is probably unintentional.
Is it possible to avoid this?