Created
June 21, 2021 01:30
-
-
Save tagaroggu/57e9c18a626f970d69e22388f7aa16c0 to your computer and use it in GitHub Desktop.
Experiments
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
<script> | |
var code = ` | |
var string="banana"; | |
var blob = new Blob([string], {type: 'text/plain'}); | |
postMessage(URL.createObjectURL(blob)); | |
`; | |
var worker = new Worker(URL.createObjectURL((new Blob([code], {type: 'application/javascript'})))); | |
worker.onmessage = _ => { | |
fetch(_.data).then(a=>a.text()).then(txt=>document.body.innerText = txt); | |
}; | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment