Last active
March 7, 2019 20:09
-
-
Save Xanir/e1808826418ddf0a671a5410570fbc4e 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 scriptId = 'api-base-path'; | |
var scriptElem = document.querySelector('script#' + scriptId) | |
var scriptBlob = new Blob([scriptElem.innerText]) | |
var scriptURL = URL.createObjectURL(scriptBlob) | |
var res = await fetch('worker.js'); | |
var script = await res.text(); | |
var scriptBlob = new Blob([script]); | |
var scriptURL = URL.createObjectURL(scriptBlob); | |
var worker = new Worker(scriptURL); | |
return worker; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment