UNPKG

2.48 kBTypeScriptView Raw
1import { Environment, EnvironmentOptions, GlimmerTreeChanges, GlimmerTreeConstruction, Transaction, TransactionSymbol, RuntimeContext, RuntimeResolver, Option, RuntimeArtifacts, ComponentInstanceWithCreate, ModifierInstance } from '@glimmer/interfaces';
2import DebugRenderTree from './debug-render-tree';
3export declare const TRANSACTION: TransactionSymbol;
4declare class TransactionImpl implements Transaction {
5 scheduledInstallModifiers: ModifierInstance[];
6 scheduledUpdateModifiers: ModifierInstance[];
7 createdComponents: ComponentInstanceWithCreate[];
8 updatedComponents: ComponentInstanceWithCreate[];
9 didCreate(component: ComponentInstanceWithCreate): void;
10 didUpdate(component: ComponentInstanceWithCreate): void;
11 scheduleInstallModifier(modifier: ModifierInstance): void;
12 scheduleUpdateModifier(modifier: ModifierInstance): void;
13 commit(): void;
14}
15export declare class EnvironmentImpl implements Environment {
16 private delegate;
17 [TRANSACTION]: Option<TransactionImpl>;
18 protected appendOperations: GlimmerTreeConstruction;
19 protected updateOperations?: GlimmerTreeChanges;
20 isInteractive: boolean;
21 debugRenderTree: DebugRenderTree<object> | undefined;
22 constructor(options: EnvironmentOptions, delegate: EnvironmentDelegate);
23 getAppendOperations(): GlimmerTreeConstruction;
24 getDOM(): GlimmerTreeChanges;
25 begin(): void;
26 private get transaction();
27 didCreate(component: ComponentInstanceWithCreate): void;
28 didUpdate(component: ComponentInstanceWithCreate): void;
29 scheduleInstallModifier(modifier: ModifierInstance): void;
30 scheduleUpdateModifier(modifier: ModifierInstance): void;
31 commit(): void;
32}
33export interface EnvironmentDelegate {
34 /**
35 * Used to determine the the environment is interactive (e.g. SSR is not
36 * interactive). Interactive environments schedule modifiers, among other things.
37 */
38 isInteractive: boolean;
39 /**
40 * Used to enable debug tooling
41 */
42 enableDebugTooling: boolean;
43 /**
44 * Callback to be called when an environment transaction commits
45 */
46 onTransactionCommit: () => void;
47}
48export declare function runtimeContext(options: EnvironmentOptions, delegate: EnvironmentDelegate, artifacts: RuntimeArtifacts, resolver: RuntimeResolver): RuntimeContext;
49export declare function inTransaction(env: Environment, cb: () => void): void;
50export default EnvironmentImpl;
51//# sourceMappingURL=environment.d.ts.map
\No newline at end of file