Shorten runAsync.md

This commit is contained in:
atomiks
2018-02-08 14:08:36 +10:00
committed by GitHub
parent 6660c7ea82
commit 6e277ec593

View File

@ -8,9 +8,8 @@ Return a promise, listening for `onmessage` and `onerror` events and resolving t
```js
const runAsync = fn => {
const blob = `var fn = ${fn.toString()}; postMessage(fn());`;
const worker = new Worker(
URL.createObjectURL(new Blob([blob]), {
URL.createObjectURL(new Blob([`postMessage((${fn})());`]), {
type: 'application/javascript; charset=utf-8'
})
);