@ricsam/isolate-client 0.1.15 → 0.1.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/dist/cjs/connection.cjs +196 -164
- package/dist/cjs/connection.cjs.map +3 -3
- package/dist/cjs/index.cjs +2 -1
- package/dist/cjs/index.cjs.map +3 -3
- package/dist/cjs/package.json +1 -1
- package/dist/mjs/connection.mjs +199 -161
- package/dist/mjs/connection.mjs.map +3 -3
- package/dist/mjs/index.mjs +3 -2
- package/dist/mjs/index.mjs.map +2 -2
- package/dist/mjs/package.json +1 -1
- package/dist/types/connection.d.ts +1 -0
- package/dist/types/index.d.ts +2 -2
- package/dist/types/types.d.ts +15 -0
- package/package.json +1 -1
package/dist/types/types.d.ts
CHANGED
|
@@ -59,6 +59,8 @@ export interface DaemonConnection {
|
|
|
59
59
|
export interface RuntimeOptions<T extends Record<string, any[]> = Record<string, unknown[]>> extends BaseRuntimeOptions<T> {
|
|
60
60
|
/** File system callback handlers */
|
|
61
61
|
fs?: FileSystemCallbacks;
|
|
62
|
+
/** Register callback for WebSocket commands from isolate at runtime creation time */
|
|
63
|
+
onWebSocketCommand?: (cmd: WebSocketCommand) => void;
|
|
62
64
|
}
|
|
63
65
|
/**
|
|
64
66
|
* WebSocket upgrade request info.
|
|
@@ -149,6 +151,19 @@ export interface RemoteRuntime {
|
|
|
149
151
|
* @param filenameOrOptions - Optional filename or eval options
|
|
150
152
|
*/
|
|
151
153
|
eval(code: string, filenameOrOptions?: string | EvalOptions): Promise<void>;
|
|
154
|
+
/**
|
|
155
|
+
* Listen for events emitted from isolate code (via __emit).
|
|
156
|
+
* @param event - The event name to listen for
|
|
157
|
+
* @param callback - Called when the event is received
|
|
158
|
+
* @returns Unsubscribe function
|
|
159
|
+
*/
|
|
160
|
+
on(event: string, callback: (payload: unknown) => void): () => void;
|
|
161
|
+
/**
|
|
162
|
+
* Emit an event to the isolate (received via __on in isolate code).
|
|
163
|
+
* @param event - The event name
|
|
164
|
+
* @param payload - The event payload (must be JSON-serializable)
|
|
165
|
+
*/
|
|
166
|
+
emit(event: string, payload: unknown): void;
|
|
152
167
|
/** Dispose the runtime */
|
|
153
168
|
dispose(): Promise<void>;
|
|
154
169
|
}
|