mirror of
https://github.com/nasa/openmct.git
synced 2025-04-12 13:47:55 +00:00
Model Cache updates models on mutation
This commit is contained in:
parent
0578a651da
commit
9a7f69a614
@ -372,7 +372,10 @@ define([
|
||||
"services": [
|
||||
{
|
||||
"key": "cacheService",
|
||||
"implementation": ModelCacheService
|
||||
"implementation": ModelCacheService,
|
||||
"depends": [
|
||||
"topic"
|
||||
]
|
||||
},
|
||||
{
|
||||
"key": "now",
|
||||
|
@ -28,8 +28,13 @@ define([], function () {
|
||||
* @constructor
|
||||
* @memberof platform/core
|
||||
*/
|
||||
function ModelCacheService() {
|
||||
function ModelCacheService(topic) {
|
||||
this.cache = {};
|
||||
topic('mutation').listen(function (domainObject) {
|
||||
if (this.has(domainObject.getId())) {
|
||||
this.put(domainObject.getId(), domainObject.getModel());
|
||||
}
|
||||
}.bind(this));
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user