UNPKG

@thi.ng/rstream

Version:

Reactive streams & subscription primitives for constructing dataflow graphs / pipelines

10 lines (9 loc) 367 B
import { isFunction } from "@thi.ng/checks/is-function"; const defInlineWorker = (src) => defWorker(new Blob([src], { type: "text/javascript" })); const defWorker = (worker) => worker instanceof Worker ? worker : isFunction(worker) ? worker() : new Worker( worker instanceof Blob ? URL.createObjectURL(worker) : worker ); export { defInlineWorker, defWorker };