import { IElementContext, IElementVar, IElementEffect, IElementSubscription, IElementStackItem, ElementId, CallbackId, IElementParams, IElementRef, } from "./types"; import { TickState } from "./TickState"; import { never } from "./never"; export class ElementState { props: any[]; contexts: IElementContext[]; func: (...args: any[]) => any; isFirstTick: boolean; isDisposed: boolean; isCompleted: boolean; isForceComplete: boolean; tickState: TickState; // vars: IElementVar[]; effects: IElementEffect[]; subscriptions: IElementSubscription[]; stack: IElementStackItem[]; currentCall?: { elementId: ElementId }; returnEventId?: CallbackId; refs: IElementRef[]; // nextValue: any; error: any; observer: { next?: CallbackId; error?: CallbackId; complete?: CallbackId; }; constructor(params: IElementParams) { this.error = undefined; this.isDisposed = false; this.isCompleted = false; this.isForceComplete = false; this.isFirstTick = true; this.tickState = new TickState(); this.contexts = []; this.func = params.func; this.props = params.args; this.effects = []; this.vars = []; this.nextValue = never(); this.subscriptions = []; this.stack = []; this.refs = []; this.observer = {}; } }