woolball-client
Version:
Client-side library for Woolball enabling secure browser resource sharing for distributed AI task processing
19 lines (18 loc) • 748 B
TypeScript
/**
* Mock implementation for Web Worker API in Node.js environment
* This file provides mocks for the Worker class and related functionality
* to enable testing of worker-related code in Jest
*/
export declare class MockWorker {
url: string;
private listeners;
constructor(url: string);
addEventListener(type: string, callback: (event: any) => void): void;
removeEventListener(type: string, callback: (event: any) => void): void;
postMessage(data: any): void;
set onmessage(handler: (event: MessageEvent) => void);
set onerror(handler: (event: ErrorEvent) => void);
triggerError(error: ErrorEvent): void;
}
export declare function setupWorkerMock(): void;
export declare function cleanupWorkerMock(): void;