Options
All
  • Public
  • Public/Protected
  • All
Menu

This view model should be used with WindowService to create and open window.

This view model has close and cancel methods. close method will close the window and will resolve the given result in promise. cancel will reject the given promise.

example
 @Inject windowService: NavigationService
 var result = await
     windowService.openPage(
         ModuleFiles.views.NewWindow,
         {
             title: "Edit Object",
             data: {
                 id: 4
             }
         });



 class NewTaskWindowViewModel extends AtomWindowViewModel{

     ....
     save(){

         // close and send result
         this.close(task);

     }
     ....

 }
export
class

AtomWindowViewModel

extends

{AtomViewModel}

Hierarchy

Index

Constructors

constructor

Properties

app

app: App

closeWarning

closeWarning: string

postInit

postInit: Function[]

title

title: string

windowName

windowName: string

windowName will be set to generated html tag id, you can use this to mock AtomWindowViewModel in testing.

When window is closed or cancelled, view model only broadcasts atom-window-close:${this.windowName}, you can listen for such message.

type

{string}

memberof

AtomWindowViewModel

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

cancel

  • cancel(): Promise<boolean>

close

  • close(result?: any): void
  • This will broadcast atom-window-close:windowName. WindowService will close the window on receipt of such message and it will resolve the promise with given result.

     this.close(someResult);
    memberof

    AtomWindowViewModel

    Parameters

    • Optional result: any

    Returns void

dispose

  • dispose(): 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

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