Created
August 12, 2020 23:53
-
-
Save cs09g/6a676e7aaaa9e82ff0cb67cccc7b0422 to your computer and use it in GitHub Desktop.
Web Worker without creating new .js file
This file contains 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
const workerScript = ` | |
// your script here | |
`; | |
const blob = new Blob([ | |
workerScript, | |
], { | |
type: "text/javascipt" | |
}); | |
const worker = new Worker(window.URL.createObjectURL(blob)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment