Rework based on Mads notes
This commit is contained in:
@@ -31,6 +31,9 @@ export class UmbContextProvider<HostType extends EventTarget = EventTarget> {
|
||||
public hostConnected() {
|
||||
this.host.addEventListener(umbContextRequestEventType, this._handleContextRequest);
|
||||
this.host.dispatchEvent(new UmbContextProvideEventImplementation(this._contextAlias));
|
||||
|
||||
// Listen to our debug event 'umb:debug-contexts'
|
||||
this.host.addEventListener('umb:debug-contexts', this._handleDebugContextRequest);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -54,6 +57,17 @@ export class UmbContextProvider<HostType extends EventTarget = EventTarget> {
|
||||
event.callback(this.#instance);
|
||||
};
|
||||
|
||||
private _handleDebugContextRequest = (event: Event) => {
|
||||
|
||||
|
||||
console.log('Context Alias:', this._contextAlias);
|
||||
console.log('Context Instance:', this.#instance);
|
||||
|
||||
// Do I update an array on the event which
|
||||
// The Debug element can then render in UI?!
|
||||
console.log('Event:', event);
|
||||
};
|
||||
|
||||
|
||||
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.
|
||||
|
||||
Reference in New Issue
Block a user