1
0
silverbullet/packages/plugos/environments/worker.ts
2022-05-09 14:59:12 +02:00

35 lines
709 B
TypeScript

import type { LogLevel } from "./custom_logger";
export type ControllerMessageType = "inited" | "result" | "syscall" | "log";
export type ControllerMessage = {
type: ControllerMessageType;
id?: number;
name?: string;
args?: any[];
error?: string;
level?: LogLevel;
message?: string;
result?: any;
};
export interface WorkerLike {
ready: Promise<void>;
onMessage?: (message: any) => Promise<void>;
postMessage(message: any): void;
terminate(): void;
}
export type WorkerMessageType = "load" | "invoke" | "syscall-response";
export type WorkerMessage = {
type: WorkerMessageType;
id?: number;
name?: string;
code?: string;
args?: any[];
result?: any;
error?: any;
};