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.
If it returns true, it means all pending initializations have finished
Returns true if all validations didn't return any error. All validations are decorated with @Validate decorator.
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 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.
This will return true if this view model is safe to cancel and close
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);
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.
Put your asynchronous initialization here
Refreshes bindings associated with given property name
name of property
Register a disposable to be disposed when view model will be disposed.
Resets validations and all errors are removed.
reset child view models as well. Default is true.
Runs function after initialization is complete.
function to execute
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}`;
}
});
Generated using TypeDoc
This view model should be used with WindowService to create and open window.
This view model has
close
andcancel
methods.close
method will close the window and will resolve the given result in promise.cancel
will reject the given promise.@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); } .... }
AtomWindowViewModel
{AtomViewModel}