Options
All
  • Public
  • Public/Protected
  • All
Menu

ViewModel class supports initialization and supports IDisposable dispose pattern.

export
class

AtomViewModel

Hierarchy

Index

Constructors

constructor

Properties

app

app: App

postInit

postInit: Function[]

Accessors

errors

  • get errors(): Array<object>

isReady

  • get isReady(): boolean

isValid

  • get isValid(): boolean

parent

  • Returns parent AtomViewModel if it was initialized with one. This property is also useful when you open an popup or window. Whenever a popup/window is opened, ViewModel associated with the UI element that opened this popup/window becomes parent of ViewModel of popup/window.

    Returns AtomViewModel

  • Returns parent AtomViewModel if it was initialized with one. This property is also useful when you open an popup or window. Whenever a popup/window is opened, ViewModel associated with the UI element that opened this popup/window becomes parent of ViewModel of popup/window.

    Parameters

    Returns void

Methods

dispose

  • dispose(): void
  • dispose method will be called when attached view will be disposed or when a new view model will be assigned to view, old view model will be disposed.

    memberof

    AtomViewModel

    Returns void

init

  • init(): Promise<any>

Protected onPropertyChanged

  • onPropertyChanged(name: string): void

Protected onReady

  • onReady(): void

refresh

  • refresh(name: string): void

Protected registerDisposable

resetValidations

  • resetValidations(resetChildren?: boolean): void
  • Resets validations and all errors are removed.

    Parameters

    • Default value resetChildren: boolean = true

      reset child view models as well. Default is true.

    Returns void

runAfterInit

  • runAfterInit(f: function): void

Protected setupWatch

  • setupWatch(ft: string[][] | function, proxy?: function, forValidation?: boolean, name?: string): IDisposable
  • Execute given expression whenever any bindable expression changes in the expression.

    For correct generic type resolution, target must always be this.

     this.setupWatch(() => {
         if(!this.data.fullName){
             this.data.fullName = `${this.data.firstName} ${this.data.lastName}`;
         }
     });
    template

    T

    memberof

    AtomViewModel

    Parameters

    • ft: string[][] | function
    • Optional proxy: function
        • (...v: any[]): void
        • Parameters

          • Rest ...v: any[]

          Returns void

    • Optional forValidation: boolean
    • Optional name: string

    Returns IDisposable

Generated using TypeDoc