From 6fc39f8d77294b516bf097b4f0571f0fc74d5194 Mon Sep 17 00:00:00 2001 From: atomiks Date: Thu, 8 Feb 2018 14:08:36 +1000 Subject: [PATCH] Shorten runAsync.md --- snippets/runAsync.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/snippets/runAsync.md b/snippets/runAsync.md index f52f400e9..09c116fbf 100644 --- a/snippets/runAsync.md +++ b/snippets/runAsync.md @@ -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' }) );