import type { MainConnection, WorkerConnection, WorldType } from './componentModel'; import type * as d from './disposable'; interface _TextEncoder { encode(input?: string): Uint8Array; } interface _TextDecoder { decode(input?: Uint8Array): string; } interface _ConnectionPort { postMessage(message: any, ...args: any[]): void; on?(event: 'message', listener: (value: any) => void): this; onmessage?: ((this: any, ev: any) => any) | null; } interface RAL { readonly TextEncoder: { create(encoding?: string): _TextEncoder; }; readonly TextDecoder: { create(encoding?: string): _TextDecoder; }; readonly console: { info(message?: any, ...optionalParams: any[]): void; log(message?: any, ...optionalParams: any[]): void; warn(message?: any, ...optionalParams: any[]): void; error(message?: any, ...optionalParams: any[]): void; }; readonly timer: { setTimeout(callback: (...args: any[]) => void, ms: number, ...args: any[]): d.Disposable; setImmediate(callback: (...args: any[]) => void, ...args: any[]): d.Disposable; setInterval(callback: (...args: any[]) => void, ms: number, ...args: any[]): d.Disposable; }; readonly Connection: { createMain(port: RAL.ConnectionPort): Promise; createWorker(port: RAL.ConnectionPort | undefined, world: WorldType, timeout?: number): Promise; }; readonly Worker: { getPort(): RAL.ConnectionPort; getArgs(): string[]; exitCode: number | undefined; }; readonly WebAssembly: { compile(bytes: Uint8Array): Promise; instantiate(module: WebAssembly_.Module, imports: WebAssembly_.Imports): Promise; }; } declare function RAL(): RAL; declare namespace RAL { type TextEncoder = _TextEncoder; type TextDecoder = _TextDecoder; type Disposable = d.Disposable; type ConnectionPort = _ConnectionPort; function install(ral: RAL): void; function isInstalled(): boolean; } export default RAL;