@gjsify/iframe 0.36.0 → 0.38.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.
package/lib/types/eval.d.ts
CHANGED
|
@@ -9,22 +9,13 @@ export type EvalResult = {
|
|
|
9
9
|
message: string;
|
|
10
10
|
};
|
|
11
11
|
/**
|
|
12
|
-
* Wrap a user expression so its value comes back as a JSON
|
|
13
|
-
*
|
|
14
|
-
* The wrapper always evaluates to a JSON string of one {@link EvalResult}
|
|
15
|
-
* shape — `ok` with the JSON-serialised value, `undefined` when the value is
|
|
16
|
-
* `undefined`, or `error` with the thrown message. A value that is not
|
|
17
|
-
* JSON-serialisable (function, circular object) collapses to `undefined`.
|
|
12
|
+
* Wrap a user expression so its value comes back as a JSON {@link EvalResult}. A value
|
|
13
|
+
* that is not JSON-serialisable (function, circular object) collapses to `undefined`.
|
|
18
14
|
*/
|
|
19
15
|
export declare function buildEvalScript(expression: string): string;
|
|
20
16
|
/**
|
|
21
|
-
* Parse the JSON string
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
* - `ok` → the deserialised value.
|
|
25
|
-
* - `undefined` → `undefined`.
|
|
26
|
-
* - `error` → throws an `Error` (name `EvalError`) carrying the page message.
|
|
27
|
-
* - malformed / `null` / non-envelope JSON → `undefined` (defensive — a
|
|
28
|
-
* tampered page or a non-wrapper result must not crash the host).
|
|
17
|
+
* Parse the JSON string {@link buildEvalScript} produces, read off the JSCValue. An
|
|
18
|
+
* `error` envelope throws (as `EvalError`) carrying the page's message; malformed or
|
|
19
|
+
* non-envelope JSON yields `undefined`, because a tampered page must not crash the host.
|
|
29
20
|
*/
|
|
30
21
|
export declare function parseEvalResult(json: string | null | undefined): unknown;
|