@tinyactors/scxmljs
    Preparing search index...

    Interface DataModel

    What a session needs from its data model. Values in and out are plain host data.

    interface DataModel {
        assignExpr(location: string, expr: string): void;
        assignValue(location: string, value: unknown): void;
        condition(expr: string): boolean;
        declareExpr(id: string, expr: string): void;
        declareValue(id: string, value: unknown): void;
        dispose(): void;
        evaluate(expr: string): unknown;
        foreach(
            arrayExpr: string,
            item: string,
            index: string | null,
            body: () => void,
        ): void;
        isValidLocation(location: string): boolean;
        script(code: string): void;
        setEvent(ev: SCXMLEvent): void;
        snapshot(ids: Iterable<string>): Record<string, unknown>;
    }
    Index

    Methods

    • <assign location expr>: evaluated and assigned inside the engine.

      Parameters

      • location: string
      • expr: string

      Returns void

    • Assign a host value (e.g. inline content) to a location.

      Parameters

      • location: string
      • value: unknown

      Returns void

    • Evaluate a conditional expression (spec §5.9.1); errors propagate.

      Parameters

      • expr: string

      Returns boolean

    • Declare (or re-initialise) a variable from an expression, keeping the value inside the engine.

      Parameters

      • id: string
      • expr: string

      Returns void

    • Declare (or re-initialise) a variable from a host value.

      Parameters

      • id: string
      • value: unknown

      Returns void

    • Release the engine (QuickJS context or realm). The data model isn't used afterwards.

      Returns void

    • Evaluate an expression; the value is returned as plain data.

      Parameters

      • expr: string

      Returns unknown

    • <foreach> (spec §4.6).

      Parameters

      • arrayExpr: string
      • item: string
      • index: string | null
      • body: () => void

      Returns void

    • Is location a valid location right now?

      Parameters

      • location: string

      Returns boolean

    • Run <script> content as a global script.

      Parameters

      • code: string

      Returns void

    • Current values of the given variables, as plain data.

      Parameters

      • ids: Iterable<string>

      Returns Record<string, unknown>