UNPKG

@zlepper/rpc

Version:

Allows RPC from the main thread to a background worker thread (Of any kind), using ES6 classes.

16 lines (15 loc) 542 B
import { CrossInvocation, CrossInvocationResult } from '../shared/cross-invocation.js'; /** * Wraps around the connection to the underlying worker */ export interface WorkerClientConnection { /** * Should serialize and send the message across to the worker */ send(message: CrossInvocation): void; /** * Invoked to register the listener. The callback should be invoked whenever * there is new data from the underlying worker. */ addListener(callback: (data: CrossInvocationResult) => void): void; }