mirror of
https://github.com/nasa/openmct.git
synced 2025-06-22 09:08:43 +00:00
Hide openmct with closures to prevent it becoming reactive
This commit is contained in:
@ -35,8 +35,11 @@ define([],
|
||||
this.id = id;
|
||||
this.hasFrame = hasFrame;
|
||||
this.rawPosition = rawPosition;
|
||||
this.openmct = openmct;
|
||||
this.mutatePosition = this.mutatePosition.bind(this);
|
||||
this.observe = openmct.objects.observe.bind(openmct.objects);
|
||||
this.mutate = function (path, value) {
|
||||
openmct.objects.mutate(this.domainObject, path, value);
|
||||
}.bind(this);
|
||||
this.listeners = [];
|
||||
}
|
||||
|
||||
@ -46,17 +49,13 @@ define([],
|
||||
this.mutate(path + ".position", this.rawPosition.position);
|
||||
}
|
||||
|
||||
mutate(path, value) {
|
||||
this.openmct.objects.mutate(this.domainObject, path, value);
|
||||
}
|
||||
|
||||
attachListeners() {
|
||||
let path = "configuration.panels[" + this.id + "].hasFrame";
|
||||
this.listeners.push(this.openmct.objects.observe(this.domainObject, path, function (newValue) {
|
||||
this.listeners.push(this.observe(this.domainObject, path, function (newValue) {
|
||||
this.hasFrame = newValue;
|
||||
}.bind(this)));
|
||||
|
||||
this.listeners.push(this.openmct.objects.observe(this.domainObject, '*', function (obj) {
|
||||
this.listeners.push(this.observe(this.domainObject, '*', function (obj) {
|
||||
this.domainObject = JSON.parse(JSON.stringify(obj));
|
||||
}.bind(this)));
|
||||
}
|
||||
|
@ -34,7 +34,10 @@ define([],
|
||||
this.domainObject = domainObject;
|
||||
this.alphanumeric = alphanumeric;
|
||||
this.rawPosition = rawPosition;
|
||||
this.openmct = openmct;
|
||||
this.observe = openmct.objects.observe.bind(openmct.objects);
|
||||
this.mutate = function (path, value) {
|
||||
openmct.objects.mutate(this.domainObject, path, value);
|
||||
}.bind(this);
|
||||
this.mutatePosition = this.mutatePosition.bind(this);
|
||||
this.listeners = [];
|
||||
}
|
||||
@ -56,12 +59,12 @@ define([],
|
||||
'size'
|
||||
].forEach(property => {
|
||||
this.listeners.push(
|
||||
this.openmct.objects.observe(this.domainObject, path + "." + property, function (newValue) {
|
||||
this.observe(this.domainObject, path + "." + property, function (newValue) {
|
||||
this.alphanumeric[property] = newValue;
|
||||
}.bind(this))
|
||||
);
|
||||
});
|
||||
this.listeners.push(this.openmct.objects.observe(this.domainObject, '*', function (obj) {
|
||||
this.listeners.push(this.observe(this.domainObject, '*', function (obj) {
|
||||
this.domainObject = JSON.parse(JSON.stringify(obj));
|
||||
}.bind(this)));
|
||||
}
|
||||
@ -73,10 +76,6 @@ define([],
|
||||
this.listeners = [];
|
||||
}
|
||||
|
||||
mutate(path, value) {
|
||||
this.openmct.objects.mutate(this.domainObject, path, value);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return TelemetryViewConfiguration;
|
||||
|
Reference in New Issue
Block a user