numbl 0.4.14 → 0.4.15
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/dist-browser/browser/protocol.d.ts +13 -0
- package/dist-browser/browser/session.d.ts +14 -0
- package/dist-browser/browser.js +21 -2
- package/dist-browser/numbl-core/version.d.ts +1 -1
- package/dist-cli/cli.js +7 -1
- package/dist-lib/lib.js +6 -0
- package/dist-lib/numbl-core/version.d.ts +1 -1
- package/dist-site-viewer/assets/{index-CqtJ-i-7.js → index-CVQsfOm5.js} +3 -3
- package/dist-site-viewer/assets/{numbl-worker-B-MPuV6f.js → numbl-worker-F20FKX9r.js} +48 -48
- package/dist-site-viewer/index.html +1 -1
- package/package.json +1 -1
|
@@ -16,6 +16,13 @@ export interface BootMessage {
|
|
|
16
16
|
optimization: "0" | "1";
|
|
17
17
|
maxIterations: number;
|
|
18
18
|
displayResults: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Shared cancellation flag (Int32[0] != 0 ⇒ cancel the running code). The
|
|
21
|
+
* worker keeps this reference and passes it to every executeCode call, so
|
|
22
|
+
* the host can interrupt a runaway run cooperatively. Only present when the
|
|
23
|
+
* page is cross-origin isolated (SharedArrayBuffer available).
|
|
24
|
+
*/
|
|
25
|
+
cancelSAB?: SharedArrayBuffer;
|
|
19
26
|
}
|
|
20
27
|
export type ToWorker = BootMessage | {
|
|
21
28
|
type: "writeFile";
|
|
@@ -51,6 +58,12 @@ export interface ExecuteResult {
|
|
|
51
58
|
plotInstructions: PlotInstruction[];
|
|
52
59
|
/** Formatted error message when `ok` is false. */
|
|
53
60
|
error?: string;
|
|
61
|
+
/**
|
|
62
|
+
* True when the run ended because it was interrupted via
|
|
63
|
+
* `NumblSession.interrupt()` (rather than finishing or erroring). The
|
|
64
|
+
* workspace is left at its pre-run state, so variables survive the abort.
|
|
65
|
+
*/
|
|
66
|
+
aborted?: boolean;
|
|
54
67
|
}
|
|
55
68
|
export type FromWorker = {
|
|
56
69
|
type: "progress";
|
|
@@ -57,6 +57,20 @@ export interface NumblSession {
|
|
|
57
57
|
* the callback returns; rejects if it errors (the session stays usable).
|
|
58
58
|
*/
|
|
59
59
|
dispatchHtmlEvent(compId: string, name: string, data: unknown): Promise<void>;
|
|
60
|
+
/**
|
|
61
|
+
* Cooperatively interrupt the currently running `execute` (or boot script):
|
|
62
|
+
* sets a shared cancel flag the worker polls at loop iterations and function
|
|
63
|
+
* calls, so it throws and the pending `execute` resolves with
|
|
64
|
+
* `aborted: true`. The worker and the persistent workspace survive — only
|
|
65
|
+
* the running command is abandoned. No-op when `canInterrupt` is false.
|
|
66
|
+
*/
|
|
67
|
+
interrupt(): void;
|
|
68
|
+
/**
|
|
69
|
+
* Whether `interrupt()` can actually stop a run. True only when the page is
|
|
70
|
+
* cross-origin isolated (SharedArrayBuffer available). When false, a runaway
|
|
71
|
+
* run can only be stopped by disposing the session.
|
|
72
|
+
*/
|
|
73
|
+
readonly canInterrupt: boolean;
|
|
60
74
|
/** Terminate the worker. The session is unusable afterwards. */
|
|
61
75
|
dispose(): void;
|
|
62
76
|
}
|