mirror of
https://github.com/nasa/openmct.git
synced 2025-03-22 12:05:19 +00:00
clean up observers
This commit is contained in:
parent
50997270e9
commit
c14cc25977
@ -69,13 +69,8 @@ class InMemorySearchProvider {
|
||||
this.worker.port.close();
|
||||
}
|
||||
|
||||
Object.entries(this.indexedIds).forEach(([keyString, unobserve]) => {
|
||||
if (typeof unobserve === 'function') {
|
||||
unobserve();
|
||||
}
|
||||
|
||||
delete this.indexedIds[keyString];
|
||||
});
|
||||
this.destroyObservers(this.indexedIds);
|
||||
this.destroyObservers(this.indexedCompositions);
|
||||
});
|
||||
}
|
||||
|
||||
@ -375,6 +370,16 @@ class InMemorySearchProvider {
|
||||
};
|
||||
this.onWorkerMessage(eventToReturn);
|
||||
}
|
||||
|
||||
destroyObservers(observers) {
|
||||
Object.entries(observers).forEach(([keyString, unobserve]) => {
|
||||
if (typeof unobserve === 'function') {
|
||||
unobserve();
|
||||
}
|
||||
|
||||
delete observers[keyString];
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export default InMemorySearchProvider;
|
||||
|
Loading…
x
Reference in New Issue
Block a user