mirror of
https://github.com/nasa/openmct.git
synced 2025-06-22 17:08:57 +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.id = id;
|
||||||
this.hasFrame = hasFrame;
|
this.hasFrame = hasFrame;
|
||||||
this.rawPosition = rawPosition;
|
this.rawPosition = rawPosition;
|
||||||
this.openmct = openmct;
|
|
||||||
this.mutatePosition = this.mutatePosition.bind(this);
|
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 = [];
|
this.listeners = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -46,17 +49,13 @@ define([],
|
|||||||
this.mutate(path + ".position", this.rawPosition.position);
|
this.mutate(path + ".position", this.rawPosition.position);
|
||||||
}
|
}
|
||||||
|
|
||||||
mutate(path, value) {
|
|
||||||
this.openmct.objects.mutate(this.domainObject, path, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
attachListeners() {
|
attachListeners() {
|
||||||
let path = "configuration.panels[" + this.id + "].hasFrame";
|
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;
|
this.hasFrame = newValue;
|
||||||
}.bind(this)));
|
}.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));
|
this.domainObject = JSON.parse(JSON.stringify(obj));
|
||||||
}.bind(this)));
|
}.bind(this)));
|
||||||
}
|
}
|
||||||
|
@ -34,7 +34,10 @@ define([],
|
|||||||
this.domainObject = domainObject;
|
this.domainObject = domainObject;
|
||||||
this.alphanumeric = alphanumeric;
|
this.alphanumeric = alphanumeric;
|
||||||
this.rawPosition = rawPosition;
|
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.mutatePosition = this.mutatePosition.bind(this);
|
||||||
this.listeners = [];
|
this.listeners = [];
|
||||||
}
|
}
|
||||||
@ -56,12 +59,12 @@ define([],
|
|||||||
'size'
|
'size'
|
||||||
].forEach(property => {
|
].forEach(property => {
|
||||||
this.listeners.push(
|
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;
|
this.alphanumeric[property] = newValue;
|
||||||
}.bind(this))
|
}.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));
|
this.domainObject = JSON.parse(JSON.stringify(obj));
|
||||||
}.bind(this)));
|
}.bind(this)));
|
||||||
}
|
}
|
||||||
@ -73,10 +76,6 @@ define([],
|
|||||||
this.listeners = [];
|
this.listeners = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
mutate(path, value) {
|
|
||||||
this.openmct.objects.mutate(this.domainObject, path, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return TelemetryViewConfiguration;
|
return TelemetryViewConfiguration;
|
||||||
|
Reference in New Issue
Block a user