@ikonai/sdk 1.0.51 → 1.0.53
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/client/ikon-client.d.ts +8 -0
- package/index.js +1808 -1717
- package/package.json +1 -1
- package/reactive/reactive-registry.d.ts +41 -0
package/package.json
CHANGED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { FunctionRegistry } from '../functions/function-registry';
|
|
2
|
+
export type ReactiveCallback<T> = (value: T) => void;
|
|
3
|
+
export interface ReactiveSubscribeOptions {
|
|
4
|
+
/**
|
|
5
|
+
* Mount id when subscribing to a server-side <c>MountReactive<T></c>. Empty/omitted
|
|
6
|
+
* means "no mount scope" — works for unscoped <c>Reactive<T></c>, <c>ClientReactive<T></c>,
|
|
7
|
+
* and <c>UserReactive<T></c>.
|
|
8
|
+
*/
|
|
9
|
+
mount?: string;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Subscribes a local callback to a server-side <c>Reactive<T></c> over the existing
|
|
13
|
+
* function-call wire. The current value is fetched on first subscribe and pushed
|
|
14
|
+
* by the server on every change. Polling is unnecessary.
|
|
15
|
+
*
|
|
16
|
+
* Routing rides the same <c>FunctionRegistry</c> machinery used for any other RPC:
|
|
17
|
+
* subscribe is an <c>Ikon.Reactive.Subscribe</c> call; updates arrive as targeted
|
|
18
|
+
* <c>Ikon.Reactive.Update</c> calls from the app server. No new opcodes.
|
|
19
|
+
*/
|
|
20
|
+
export declare class ReactiveRegistry {
|
|
21
|
+
private readonly subscribersByKey;
|
|
22
|
+
private readonly functionRegistry;
|
|
23
|
+
private updateHandlerUnregister;
|
|
24
|
+
constructor(functionRegistry: FunctionRegistry);
|
|
25
|
+
/**
|
|
26
|
+
* Subscribe to a server-side reactive identified by its stable id.
|
|
27
|
+
* The callback fires once with the current value, then on every server-side change.
|
|
28
|
+
* Returns an unsubscribe function.
|
|
29
|
+
*
|
|
30
|
+
* Pass <c>options.mount</c> when subscribing to a <c>MountReactive<T></c>.
|
|
31
|
+
*/
|
|
32
|
+
subscribe<T>(stableId: string, callback: ReactiveCallback<T>, options?: ReactiveSubscribeOptions): Promise<() => void>;
|
|
33
|
+
/**
|
|
34
|
+
* Drop all subscriptions. Intended for use during client teardown — does not
|
|
35
|
+
* notify the server (the server's per-session subscription map is cleaned up
|
|
36
|
+
* when the session disconnects).
|
|
37
|
+
*/
|
|
38
|
+
detach(): void;
|
|
39
|
+
private unsubscribeOne;
|
|
40
|
+
private registerUpdateHandler;
|
|
41
|
+
}
|