mirror of
https://github.com/nasa/openmct.git
synced 2025-06-23 09:25:29 +00:00
* [#3789] Don't observe objects if they are already mutable objects. Add some null checks. * Don't destroy mutable in Selection.js if it wasn't created in that context. * Remove * listeners and add null checks * Don't delete _observers and _globalEventEmitters on $destroy. Pop all items off the _observers list for a mutable domain object. Co-authored-by: Andrew Henry <akhenry@gmail.com>
This commit is contained in:
@ -112,9 +112,11 @@ class MutableDomainObject {
|
||||
return () => this._instanceEventEmitter.off(event, callback);
|
||||
}
|
||||
$destroy() {
|
||||
this._observers.forEach(observer => observer());
|
||||
delete this._globalEventEmitter;
|
||||
delete this._observers;
|
||||
while (this._observers.length > 0) {
|
||||
const observer = this._observers.pop();
|
||||
observer();
|
||||
}
|
||||
|
||||
this._instanceEventEmitter.emit('$_destroy');
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user