-
Notifications
You must be signed in to change notification settings - Fork 9
worker interface.Function.getWorkerInterface
github-actions[bot] edited this page Apr 2, 2025
·
17 revisions
@monogrid/gainmap-js / worker-interface / getWorkerInterface
getWorkerInterface(
worker
):WorkerInterfaceImplementation
Defined in: src/worker-interface.ts:33
Returns an interface where methods of the worker can be called by the host site
// this assumes a vite-like bundler understands the `?worker` import
import GainMapWorker from '@monogrid/gainmap-js/worker?worker'
import { getPromiseWorker, getWorkerInterface } from '@monogrid/gainmap-js/worker-interface'
// turn our Worker into a PromiseWorker
const promiseWorker = getPromiseWorker(new GainMapWorker())
// get the interface
const workerInterface = getWorkerInterface(promiseWorker)