WorkerApiHandlers<TApi>
The handlers implementing a WorkerApi, with the WorkerCallContext as this.
Each handler takes the method’s arguments and returns its result, or a promise of it, or the result wrapped by withTransfer to transfer buffers back instead of copying them. Declare the handlers as methods or function expressions, not arrow functions, when they need this.
Import:
import type { WorkerApiHandlers } from '@mnaoumov/obsidian-lib/worker-protocol';Signature:
export type WorkerApiHandlers<TApi extends WorkerApi<TApi>>Signature:
type WorkerApiHandlers<TApi> = { readonly [TMethod in keyof TApi]: ( this: WorkerCallContext, ...parameters: Parameters<TApi[TMethod]> ) => WorkerHandlerResult<Awaited<ReturnType<TApi[TMethod]>>>;}Type: { readonly [TMethod in keyof TApi]: ( this: WorkerCallContext, …parameters: Parameters<TApi[TMethod]> ) => WorkerHandlerResult<Awaited<ReturnType<TApi[TMethod]>>>; }
Links to this page: