@byterygon/workerr
Version:
Workerr is a lightweight library that simplifies working with Web Workers in JavaScript. It provides a more intuitive way to handle parallel tasks by using Promises, along with a built-in worker pool to efficiently manage worker instances. With strong Typ
12 lines (11 loc) • 415 B
TypeScript
export type InvokeHandlers<IContext extends object> = {
[cmd in string]: (body: any, options: {
abortSignal?: AbortSignal;
context: IContext;
transferObject: (transfer: Transferable[]) => void;
}) => any | Promise<any>;
};
export declare class CommandBuilder<IContext extends object> {
constructor();
buildInvokeHandlers<C extends InvokeHandlers<IContext>>(command: C): C;
}