import type { EnvironmentWorker } from '../createWorker.ts'; /** * Creates a worker in a web browser. * * Defines a `var postMessage = (data, [transferList]) => ...` function. * Requires a `var onMessage = (data) => ...` function to be defined. * * @param {string} javascriptCode * @param {function} getFromCache — Could be used to add caching. Has no arguments. Returns the cached value. * @param {function} setInCache — Could be used to add caching. Receives the value to cache as an argument. Doesn't return anything. * @param {function} onError — This function will be called every time when there was an error while processing an incoming message. It would be logical to call `worker.terminate()` inside this function. * @param {function} onOutput — This function will be called every time when done processing an incoming message. * @returns {Worker} — An object with methods: `ingest(data, transferList)`, `stop()`. */ export default function createWorkerInBrowser(javascriptCode: string, getFromCache: () => CacheValue | undefined, setInCache: (value: CacheValue) => void, onError: (error: unknown) => void, onOutput: (output: OutputData) => void): EnvironmentWorker; type CacheValue = string; export {};