mirror of
https://github.com/nasa/openmct.git
synced 2025-06-04 16:40:53 +00:00
[Status] Clean up classes when destroyed
This commit is contained in:
parent
29fdb6d641
commit
0d07c3c289
@ -48,6 +48,17 @@ define(
|
|||||||
this.lastClasses = [];
|
this.lastClasses = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove any status-related classes from this representation.
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
StatusRepresenter.prototype.clearClasses = function () {
|
||||||
|
var element = this.element;
|
||||||
|
this.lastClasses.forEach(function (c) {
|
||||||
|
element.removeClass(c);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
StatusRepresenter.prototype.represent = function (representation, domainObject) {
|
StatusRepresenter.prototype.represent = function (representation, domainObject) {
|
||||||
var self = this,
|
var self = this,
|
||||||
statusCapability = domainObject.getCapability('status');
|
statusCapability = domainObject.getCapability('status');
|
||||||
@ -57,9 +68,7 @@ define(
|
|||||||
return STATUS_CLASS_PREFIX + flag;
|
return STATUS_CLASS_PREFIX + flag;
|
||||||
});
|
});
|
||||||
|
|
||||||
self.lastClasses.forEach(function (c) {
|
self.clearClasses();
|
||||||
self.element.removeClass(c);
|
|
||||||
});
|
|
||||||
|
|
||||||
newClasses.forEach(function (c) {
|
newClasses.forEach(function (c) {
|
||||||
self.element.addClass(c);
|
self.element.addClass(c);
|
||||||
@ -73,6 +82,7 @@ define(
|
|||||||
};
|
};
|
||||||
|
|
||||||
StatusRepresenter.prototype.destroy = function () {
|
StatusRepresenter.prototype.destroy = function () {
|
||||||
|
this.clearClasses();
|
||||||
if (this.unlisten) {
|
if (this.unlisten) {
|
||||||
this.unlisten();
|
this.unlisten();
|
||||||
this.unlisten = undefined;
|
this.unlisten = undefined;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user