From d9f3bfd8e2895894bd9d5b32f565d2f6798ada77 Mon Sep 17 00:00:00 2001 From: 30secondsofcode <30secondsofcode@gmail.com> Date: Fri, 9 Feb 2018 07:06:16 +0000 Subject: [PATCH] Travis build: 1611 --- README.md | 3 +-- docs/index.html | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 39fc8c4fa..d6f750d77 100644 --- a/README.md +++ b/README.md @@ -3275,9 +3275,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' }) ); diff --git a/docs/index.html b/docs/index.html index fc78ace94..110dec1cb 100644 --- a/docs/index.html +++ b/docs/index.html @@ -700,9 +700,8 @@ document.body? (window.location.href = url) : window.location.replace(url);
redirect('https://google.com');
Runs a function in a separate thread by using a Web Worker, allowing long running functions to not block the UI.
Create a new Worker using a Blob object URL, the contents of which should be the stringified version of the supplied function. Immediately post the return value of calling the function back. Return a promise, listening for onmessage and onerror events and resolving the data posted back from the worker, or throwing an error.
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' }) );