mirror of
https://github.com/nasa/openmct.git
synced 2025-01-20 11:38:56 +00:00
[Persistence] Only auto-persist previously saved domain objects
This commit is contained in:
parent
6418b0c634
commit
b0cbb5a2b4
@ -202,6 +202,15 @@ define(
|
|||||||
return this.identifierService.parse(id).getSpace();
|
return this.identifierService.parse(id).getSpace();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if this domain object has been persisted at some
|
||||||
|
* point.
|
||||||
|
* @returns {boolean} true if the object has been persisted
|
||||||
|
*/
|
||||||
|
PersistenceCapability.prototype.persisted = function () {
|
||||||
|
return this.domainObject.getModel().persisted !== undefined;
|
||||||
|
};
|
||||||
|
|
||||||
return PersistenceCapability;
|
return PersistenceCapability;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
@ -34,7 +34,9 @@ define([], function () {
|
|||||||
var mutationTopic = topic('mutation');
|
var mutationTopic = topic('mutation');
|
||||||
mutationTopic.listen(function (domainObject) {
|
mutationTopic.listen(function (domainObject) {
|
||||||
var persistence = domainObject.getCapability('persistence');
|
var persistence = domainObject.getCapability('persistence');
|
||||||
persistence.persist();
|
if (persistence.persisted()) {
|
||||||
|
persistence.persist();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user