diff --git a/index.js b/index.js index 212816f..6b1caed 100644 --- a/index.js +++ b/index.js @@ -142,7 +142,5 @@ function withMessageInterceptor(worker) { export { offload, handler, - createPooledCallback, - createBufferedCallback, OffloadError }; diff --git a/jsr.json b/jsr.json index c41a005..305f5bf 100644 --- a/jsr.json +++ b/jsr.json @@ -1,5 +1,5 @@ { "name": "@nesterow/offload", - "version": "0.0.1", + "version": "0.0.2", "exports": "./mod.ts" } diff --git a/offload.error.ts b/offload.error.ts index 944df89..987b7e4 100644 --- a/offload.error.ts +++ b/offload.error.ts @@ -1,3 +1,6 @@ +/** + * OffloadError class + */ export class OffloadError extends Error { constructor(message: string, options?: any) { super(message, options); diff --git a/offload.handler.ts b/offload.handler.ts index b5b4ccd..620db23 100644 --- a/offload.handler.ts +++ b/offload.handler.ts @@ -4,6 +4,9 @@ declare var self: Worker; type HandlerCallback = ((data: E) => T) | ((data: E) => Awaited); +/** + * Handler wraps a callback function to be used as a worker handler + */ export async function handler(fn: HandlerCallback): Promise { self.addEventListener("message", async (event) => { const request = event.data as WorkerRequest; diff --git a/offload.interface.ts b/offload.interface.ts index f08555f..4a83624 100644 --- a/offload.interface.ts +++ b/offload.interface.ts @@ -1,2 +1,8 @@ +/** + * Response from a worker + */ export type WorkerResponse = { id: number; value: T }; +/** + * Request to a worker + */ export type WorkerRequest = { id: number; params: T }; diff --git a/offload.ts b/offload.ts index 0193abd..85486f2 100644 --- a/offload.ts +++ b/offload.ts @@ -82,7 +82,7 @@ function createTaskCallback( return cb; } -export function createBufferedCallback( +function createBufferedCallback( bufSize: number, fun: () => TaskCallback, ): [Callback, Terminator] { @@ -112,7 +112,7 @@ export function createBufferedCallback( return [call, term]; } -export function createPooledCallback( +function createPooledCallback( poolSize: number, fun: () => TaskCallback, ): [Callback, Terminator] { diff --git a/package.json b/package.json index bfe645a..f51ad8f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@nesterow/offload", - "version": "0.0.1", + "version": "0.0.2", "author": { "name": "Anton Nesterov", "url": "https://github.com/nesterow"