Options
All
  • Public
  • Public/Protected
  • All
Menu

Class DualModel<TModel>

Conceived of as a way to synchronize the data in an ECS with a UI, though it can be used in any situation in which a user needs to interact with a system asynchronously. The user's desired state of the system is modeled using the same data structure which represents the actual state of the system. The system can then act on the user's input and update the model of its actual state as it sees fit. The responsibility of keeping the model of the user's desires in sync with the actual system state is on the user interface. The system uses a dirty flag to know if the desired state has changed since the last call to clean().

Type parameters

  • TModel: Object | Array<any> | number | string | boolean

Hierarchy

  • DualModel

Index

Constructors

constructor

  • new DualModel<TModel>(modelFactory: IModelFactory<TModel>, options?: IOptions): DualModel<TModel>
  • Type parameters

    • TModel: string | number | boolean | Object | any[]

    Parameters

    • modelFactory: IModelFactory<TModel>
    • options: IOptions = ...

    Returns DualModel<TModel>

Properties

_actual

_actual: TModel

_dirty

_dirty: boolean = false

_request

_request: TModel

Accessors

actual

  • get actual(): TModel

isDirty

  • get isDirty(): boolean

request

  • get request(): TModel

Methods

_logDebugMsg

  • _logDebugMsg(...args: any[]): void

clean

  • clean(): void

setActual

  • setActual(model: TModel): void

setDirty

  • setDirty(): void

setRequest

  • setRequest(model: TModel): void

setRequestPart

  • setRequestPart(partial: Partial<TModel>): void

Generated using TypeDoc