From ac12cb6f287bf40bf7ecea8ad86e8a0b41c7ea0b Mon Sep 17 00:00:00 2001 From: Eddie Antonio Santos Date: Tue, 27 Nov 2018 14:32:37 -0700 Subject: [PATCH] Add example to docs for LMLayer.asBlobURI(). --- common/predictive-text/index.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/common/predictive-text/index.ts b/common/predictive-text/index.ts index 7b67d6acb4..e739569833 100644 --- a/common/predictive-text/index.ts +++ b/common/predictive-text/index.ts @@ -61,6 +61,15 @@ class LMLayer { * Converts the INSIDE of a function into a blob URI that can * be passed as a valid URI for a Worker. * @param fn Function whose body will be referenced by a URI. + * + * This function makes the following possible: + * + * let worker = new Worker(LMLayer.asBlobURI(function myWorkerCode () { + * postMessage('inside Web Worker') + * function onmessage(event) { + * // handle message inside Web Worker. + * } + * })); */ static asBlobURI(fn: Function): string { let code = LMLayer.unwrap(fn);