mirror of
https://github.com/nasa/openmct.git
synced 2025-01-18 10:46:42 +00:00
[Status] Clean up classes when destroyed
This commit is contained in:
parent
29fdb6d641
commit
0d07c3c289
@ -48,6 +48,17 @@ define(
|
||||
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) {
|
||||
var self = this,
|
||||
statusCapability = domainObject.getCapability('status');
|
||||
@ -57,9 +68,7 @@ define(
|
||||
return STATUS_CLASS_PREFIX + flag;
|
||||
});
|
||||
|
||||
self.lastClasses.forEach(function (c) {
|
||||
self.element.removeClass(c);
|
||||
});
|
||||
self.clearClasses();
|
||||
|
||||
newClasses.forEach(function (c) {
|
||||
self.element.addClass(c);
|
||||
@ -73,6 +82,7 @@ define(
|
||||
};
|
||||
|
||||
StatusRepresenter.prototype.destroy = function () {
|
||||
this.clearClasses();
|
||||
if (this.unlisten) {
|
||||
this.unlisten();
|
||||
this.unlisten = undefined;
|
||||
|
Loading…
Reference in New Issue
Block a user