@perspective-dev/client 4.4.0 → 4.5.0

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.
@@ -7,6 +7,24 @@ export declare function createMessageHandler(handler: psp_virtual.VirtualServerH
7
7
  export declare function init_server(wasm: Uint8Array | Promise<ArrayBuffer | Response | WebAssembly.Module> | ArrayBuffer | Response | WebAssembly.Module, disable_stage_0?: boolean): void;
8
8
  export type PerspectiveWasm = ArrayBuffer | Response | typeof psp | Promise<ArrayBuffer | Response | Object>;
9
9
  export declare function init_client(wasm: PerspectiveWasm, disable_stage_0?: boolean): void;
10
+ /**
11
+ * Returns the compiled `WebAssembly.Module` for the perspective-js client
12
+ * runtime. The module is structured-cloneable, so it can be sent via
13
+ * `postMessage` to a Worker which can instantiate its own `Client` without
14
+ * re-fetching or re-compiling the wasm binary.
15
+ *
16
+ * Requires that the client wasm has been initialized — typically by a prior
17
+ * call to `init_client(...)`, or implicitly by mounting a `<perspective-viewer>`
18
+ * element. Throws otherwise.
19
+ *
20
+ * # Examples
21
+ *
22
+ * ```javascript
23
+ * const mod = await perspective.getCompiledClientWasm();
24
+ * worker.postMessage({ kind: "init", clientWasm: mod }, [port]);
25
+ * ```
26
+ */
27
+ export declare function getCompiledClientWasm(): Promise<WebAssembly.Module>;
10
28
  export declare function websocket(url: string | URL): Promise<psp.Client>;
11
29
  export declare function worker(worker?: Promise<SharedWorker | ServiceWorker | Worker | MessagePort>): Promise<psp.Client>;
12
30
  declare const _default: {
@@ -15,6 +33,7 @@ declare const _default: {
15
33
  init_client: typeof init_client;
16
34
  init_server: typeof init_server;
17
35
  createMessageHandler: typeof createMessageHandler;
36
+ getCompiledClientWasm: typeof getCompiledClientWasm;
18
37
  GenericSQLVirtualServerModel: typeof psp.GenericSQLVirtualServerModel;
19
38
  VirtualDataSlice: typeof psp.VirtualDataSlice;
20
39
  VirtualServer: typeof psp.VirtualServer;