@orbitinghail/sqlsync-worker
Version:
SQLSync is a collaborative offline-first wrapper around SQLite. It is designed to synchronize web application state between users, devices, and the edge.
24 lines (23 loc) • 780 B
TypeScript
import { WorkerToHostMsg } from "../sqlsync-wasm/pkg/sqlsync_wasm.js";
export type PortId = number;
export declare const nextPortId: () => number;
export declare class Port {
readonly port: WeakRef<MessagePort>;
constructor(port: MessagePort);
postMessage(msg: WorkerToHostMsg): void;
close(): void;
}
export declare class PortRouter {
#private;
constructor();
register(port: MessagePort): PortId;
unregister(id: PortId): void;
sendOne(portId: PortId, msg: WorkerToHostMsg): void;
sendMany(portIds: PortId[], msg: WorkerToHostMsg): void;
sendAll(msg: WorkerToHostMsg): void;
}
export declare class SendError extends Error {
readonly _missingPorts: PortId[];
constructor(_missingPorts: PortId[]);
missingPorts(): number[];
}