gazeplotter
Version:
Gazeplotter is a Svelte application for visualizing eye-tracking data.
40 lines (39 loc) • 1.6 kB
TypeScript
import type { DataType } from '../../type/Data/DataType.ts';
/**
* Creates a worker to handle whole eyefiles processing.
* It is a separate file to avoid blocking the main thread.
*
* Workers must be instantiated in a specific way to work with TypeScript modules in Vite:
* new Worker(new URL('path/to/typescriptWorker.ts', import.meta.url), { type: 'module' })
*/
export declare class EyeWorkerService {
worker: Worker;
onData: (data: DataType) => void;
constructor(onData: (data: DataType) => void);
/**
* Sends the given files to the worker.
* @param files - The files to send.
*/
sendFiles(files: FileList): void;
/**
* Makes a test postMessage call to the worker to check if the browser supports transferable streams.
* If the browser does not support transferable streams, runtimes will throw an error.
* This method catches the error and returns false.
*
* @returns {boolean} - Whether the browser supports transferable streams.
*/
isStreamTransferable(): boolean;
processDataAsStream(files: FileList): void;
processDataAsArrayBuffer(files: FileList): Promise<void>;
processJsonWorkspace(file: File): void;
protected handleMessage(event: MessageEvent): void;
protected handleError(event: ErrorEvent): void;
handleUserInputProcess(): void;
/**
* Requests user input for further processing,
* to determine how to parse stimuli in the file.
*
* The user input is then sent to the worker which resumes processing.
*/
requestUserInput(): Promise<string>;
}