idea on subscribtion

This commit is contained in:
Niels Lyngsø
2022-05-25 18:58:00 +02:00
parent 22ccf286e1
commit 79ac0a60bf

View File

@@ -18,6 +18,9 @@ export class UmbSettingsSection extends UmbContextConsumerMixin(LitElement) {
this.consumeContext('umbExtensionRegistry', (_instance: UmbExtensionRegistry) => {
this._extensionRegistry = _instance;
// TODO: Could we make it easier to unsubscribe? If we invented a Pattern/Mixin/class ala Lit-Controllers we could make it auto unsubscribe.
// ContextConsumers could be turned into single classes which uses the 'Controller' ability to hook into connected and disconnected.
// Generally that means that a web component must have the ControllerMixin?? and then controllers can easily be attached, they would know about life cycle and thereby be able to unsubscribe on disconnected etc.
this._extensionsSubscription?.unsubscribe();
this._extensionsSubscription = this._extensionRegistry.extensions.subscribe(extensions => {