2022-05-09 12:59:12 +00:00
|
|
|
import type { LogLevel } from "./custom_logger";
|
2022-03-23 14:41:12 +00:00
|
|
|
|
2022-05-13 12:36:26 +00:00
|
|
|
export type ControllerMessageType =
|
|
|
|
| "inited"
|
|
|
|
| "dependency-inited"
|
|
|
|
| "result"
|
|
|
|
| "syscall"
|
|
|
|
| "log";
|
|
|
|
|
2022-03-23 14:41:12 +00:00
|
|
|
export type ControllerMessage = {
|
|
|
|
type: ControllerMessageType;
|
|
|
|
id?: number;
|
|
|
|
name?: string;
|
|
|
|
args?: any[];
|
|
|
|
error?: string;
|
2022-05-09 12:59:12 +00:00
|
|
|
level?: LogLevel;
|
|
|
|
message?: string;
|
2022-03-23 14:41:12 +00:00
|
|
|
result?: any;
|
|
|
|
};
|
|
|
|
|
|
|
|
export interface WorkerLike {
|
|
|
|
ready: Promise<void>;
|
|
|
|
onMessage?: (message: any) => Promise<void>;
|
|
|
|
|
|
|
|
postMessage(message: any): void;
|
|
|
|
|
|
|
|
terminate(): void;
|
|
|
|
}
|
|
|
|
|
2022-05-13 12:36:26 +00:00
|
|
|
export type WorkerMessageType =
|
|
|
|
| "load"
|
|
|
|
| "load-dependency"
|
|
|
|
| "invoke"
|
|
|
|
| "syscall-response";
|
2022-03-24 09:48:56 +00:00
|
|
|
|
2022-03-23 14:41:12 +00:00
|
|
|
export type WorkerMessage = {
|
|
|
|
type: WorkerMessageType;
|
|
|
|
id?: number;
|
|
|
|
name?: string;
|
|
|
|
code?: string;
|
|
|
|
args?: any[];
|
|
|
|
result?: any;
|
|
|
|
error?: any;
|
|
|
|
};
|