Session ​

Contract 2.0.0 · package sha256 a857eca95b35921109faf997094bb4192f12527d9d0fcd4be7e97f06425bad6e · generated from configurator-runtime.d.ts by services/onsite-scripter/scripts/build-contract-docs.mjs; edit the source, not this file.

Interface · import type { Session } from '@holostep-configurators/runtime-client/contract'; · stable · since 2.0.0 · section 5. Writers, transactions, session

A configurator session. Every member except destroy() throws DOMException 'InvalidStateError' after destroy(); the terminal calls (every dispose(), every disposer a registration returns: on, onFrame, follow, beforeCommit, input.drag, labs.lightLinking; overlays.anchors.clear(), overlays.hotspots.set([]), overlays.hotspots.clear()) do nothing then, as destroy() does (spec section 6.5).

Members ​

Member Kind Summary
revision property Read class: intent.
seq property Read class: intent.
history property Undo state, undo groups and the history floor.
input property Picking, raycasts and drags on the canvas.
overlays property Screen overlays the runtime draws or tracks: hotspot badges, anchors and dimension rulers.
document property The merged viewer document, in version-2 form: platform defaults, then your page document, then account defaults, then the configurator's stored document, which wins.
transaction method One all-or-nothing change that may await (loads, attach).
beforeCommit? method · labs Registers a hook that runs inside every recorded commit (writes, queued writes, undo, redo, restore, reload), after loads and before the commit point.
undo method Undoes the last committed step (recorded).
redo method Redoes the last undone step.
on method Subscribes.
onFrame method A per-frame hook.
idle method Resolves when nothing is open, queued, loading or animating, and the latest commit is shown: the frame that draws it has been drawn, so info().scene, the canvas or a screenshot read right after it shows that state.
capture method Captures committed state as an image.
export method Exports the matched parts (role 'product' by default) as a GLB or USDZ file.
activateAR method Launches AR for the product.
canTryOn? method · labs Whether the product on screen can be tried on in this page now: Holostep's camera try-on (glasses, shoes, watches).
tryOn? method · labs Opens try-on.
endAR? method · labs Closes Holostep's in-page AR or try-on from page code; their pending activateAR() or tryOn() resolves.
describe method Read class: authored.
supports method Whether this runtime implements a capability.
permits method Whether this account may use a gated capability ('export', 'labs.geometry.read').
applyDocument method Replaces the page document layer (version 2).
info method A diagnostic snapshot, sync: the contract, runtime version, renderer backend and tier, device limits, the AR modes this device can open, document layers and recorded problems.
destroy method Terminal and immediate.

Inherited from Writer: node, find, collection, apply, applyPatch, setSceneModel, select, stage, materials, assembly, camera, animations, labs, state, getSceneModel.

Declaration ​

ts
export interface Session extends Writer<CommitOptions> {
  readonly revision: number;
  readonly seq: number;
  readonly history: History;
  readonly input: Input;
  readonly overlays: Overlays;
  readonly document: ViewerDocumentJson;
  transaction<T>(work: (tx: Tx) => T | Promise<T>, options?: TransactionOptions): Promise<TransactionReport<T>>;
  beforeCommit?(name: string, fn: (commit: BeforeCommitContext) => void | Promise<void>, options?: SignalOption): () => void;
  undo(options?: WriteOptions): Promise<Report>;
  redo(options?: WriteOptions): Promise<Report>;
  on<K extends keyof Events, R>(event: K, handler: (payload: Events[K]) => NotAsync<R>, options?: SignalOption): () => void;
  onFrame<R>(callback: (frame: Frame) => NotAsync<R>, options?: FrameOptions): () => void;
  idle(options?: SignalOption): Promise<void>;
  capture(spec?: CaptureSpec, options?: SignalOption): Promise<CaptureResult>;
  export(options: ExportOptions, extra?: SignalOption): Promise<ExportResult>;
  activateAR(options?: ActivateAROptions): Promise<ActivateARReport>;
  canTryOn?(): TryOnAvailability;
  tryOn?(options?: TryOnOptions): Promise<TryOnReport>;
  endAR?(): void;
  describe(node: string): ModelDescription | null;
  supports(capability: Capability): boolean;
  permits(capability: 'export' | 'labs.geometry.read' | (string & {})): boolean;
  applyDocument(document: ViewerDocumentJson, options?: SignalOption): Promise<ApplyReport>;
  info(): InfoReport;
  destroy(): void;
}

Generic-API test (spec 3.1) ​

Rule Result
1. Neutral name pass: Session names no product
2. A precedent not recorded: no ledger row (coverage.json) names this member or its owner
3. Two apps, or labs not recorded: no ledger row names this member or its owner
4. The cheaper fix first not recorded per member (Appendix B decides it per need)