mirror of
https://github.com/nasa/openmct.git
synced 2024-12-18 20:57:53 +00:00
[API] Synchronize view to model
This commit is contained in:
parent
4a50f325cb
commit
370b515c23
@ -106,6 +106,10 @@ define([
|
||||
var persistence = domainObject.getCapability('persistence');
|
||||
return persistence.persist();
|
||||
});
|
||||
},
|
||||
observe: function (domainObject, callback) {
|
||||
var mutation = domainObject.getCapability('mutation');
|
||||
return mutation.listen(callback);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -29,6 +29,8 @@ define([
|
||||
}
|
||||
|
||||
TodoView.prototype.show = function (container) {
|
||||
this.destroy();
|
||||
|
||||
this.$els = $(todoTemplate);
|
||||
this.$buttons = {
|
||||
all: this.$els.find('.example-todo-button-all'),
|
||||
@ -40,9 +42,15 @@ define([
|
||||
|
||||
this.initialize();
|
||||
this.render();
|
||||
|
||||
mct.verbs.observe(this.domainObject, this.render.bind(this));
|
||||
};
|
||||
|
||||
TodoView.prototype.destroy = function () {
|
||||
if (this.unlisten) {
|
||||
this.unlisten();
|
||||
this.unlisten = undefined;
|
||||
}
|
||||
};
|
||||
|
||||
TodoView.prototype.setFilter = function (value) {
|
||||
|
Loading…
Reference in New Issue
Block a user