UNPKG

1.18 kBTypeScriptView Raw
1import type { Destroyable } from '../core.js';
2import type { GlimmerTreeChanges } from '../dom/changes.js';
3import type { Reference } from '../references.js';
4import type { Environment } from './environment.js';
5import type { Owner } from './owner.js';
6import type { ExceptionHandler } from './render.js';
7import type { DynamicScope } from './scope.js';
8/**
9 * This is used in the Glimmer Embedding API. In particular, embeddings
10 * provide helpers through the `CompileTimeLookup` interface, and the
11 * helpers they provide implement the `Helper` interface, which is a
12 * function that takes a `VM` as a parameter.
13 */
14export interface VM<O extends Owner = Owner> {
15 env: Environment;
16 dynamicScope(): DynamicScope;
17 getOwner(): O;
18 getSelf(): Reference;
19 associateDestroyable(child: Destroyable): void;
20}
21
22export interface UpdatingVM {
23 env: Environment;
24 dom: GlimmerTreeChanges;
25 alwaysRevalidate: boolean;
26
27 execute(opcodes: UpdatingOpcode[], handler: ExceptionHandler): void;
28 goto(index: number): void;
29 try(ops: UpdatingOpcode[], handler: ExceptionHandler | null): void;
30 throw(): void;
31}
32
33export interface UpdatingOpcode {
34 evaluate(vm: UpdatingVM): void;
35}