@glimmer/runtime
Version:
Minimal runtime needed to render Glimmer templates
51 lines • 2.48 kB
TypeScript
import { Environment, EnvironmentOptions, GlimmerTreeChanges, GlimmerTreeConstruction, Transaction, TransactionSymbol, RuntimeContext, RuntimeResolver, Option, RuntimeArtifacts, ComponentInstanceWithCreate, ModifierInstance } from '@glimmer/interfaces';
import DebugRenderTree from './debug-render-tree';
export declare const TRANSACTION: TransactionSymbol;
declare class TransactionImpl implements Transaction {
scheduledInstallModifiers: ModifierInstance[];
scheduledUpdateModifiers: ModifierInstance[];
createdComponents: ComponentInstanceWithCreate[];
updatedComponents: ComponentInstanceWithCreate[];
didCreate(component: ComponentInstanceWithCreate): void;
didUpdate(component: ComponentInstanceWithCreate): void;
scheduleInstallModifier(modifier: ModifierInstance): void;
scheduleUpdateModifier(modifier: ModifierInstance): void;
commit(): void;
}
export declare class EnvironmentImpl implements Environment {
private delegate;
[TRANSACTION]: Option<TransactionImpl>;
protected appendOperations: GlimmerTreeConstruction;
protected updateOperations?: GlimmerTreeChanges;
isInteractive: boolean;
debugRenderTree: DebugRenderTree<object> | undefined;
constructor(options: EnvironmentOptions, delegate: EnvironmentDelegate);
getAppendOperations(): GlimmerTreeConstruction;
getDOM(): GlimmerTreeChanges;
begin(): void;
private get transaction();
didCreate(component: ComponentInstanceWithCreate): void;
didUpdate(component: ComponentInstanceWithCreate): void;
scheduleInstallModifier(modifier: ModifierInstance): void;
scheduleUpdateModifier(modifier: ModifierInstance): void;
commit(): void;
}
export interface EnvironmentDelegate {
/**
* Used to determine the the environment is interactive (e.g. SSR is not
* interactive). Interactive environments schedule modifiers, among other things.
*/
isInteractive: boolean;
/**
* Used to enable debug tooling
*/
enableDebugTooling: boolean;
/**
* Callback to be called when an environment transaction commits
*/
onTransactionCommit: () => void;
}
export declare function runtimeContext(options: EnvironmentOptions, delegate: EnvironmentDelegate, artifacts: RuntimeArtifacts, resolver: RuntimeResolver): RuntimeContext;
export declare function inTransaction(env: Environment, cb: () => void): void;
export default EnvironmentImpl;
//# sourceMappingURL=environment.d.ts.map