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