optional destroy on context instances
This commit is contained in:
@@ -20,6 +20,7 @@ export class UmbContextProviderController<T = unknown>
|
||||
}
|
||||
|
||||
public destroy() {
|
||||
super.destroy();
|
||||
if (this.host) {
|
||||
this.host.removeController(this);
|
||||
}
|
||||
|
||||
@@ -53,4 +53,10 @@ export class UmbContextProvider<HostType extends EventTarget = EventTarget> {
|
||||
event.stopPropagation();
|
||||
event.callback(this.#instance);
|
||||
};
|
||||
|
||||
|
||||
destroy(): void {
|
||||
// I want to make sure to call this, but for now it was too overwhelming to require the destroy method on context instances.
|
||||
(this.#instance as any).destroy?.();
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user