Bump version to 1.1.3, add detailed lifecycle logging in debug mode, and enhance error handling in services
This commit is contained in:
@@ -24,6 +24,11 @@ export class MegaMenuRenderer {
|
||||
) { }
|
||||
|
||||
public render(container: HTMLElement): void {
|
||||
debugLog(this.debug, LOG_SOURCE, 'Render started.', {
|
||||
menuItemCount: this.menuItems.length,
|
||||
containerId: container.id || '',
|
||||
containerClassName: container.className || ''
|
||||
});
|
||||
this.dispose();
|
||||
this._container = container;
|
||||
container.innerHTML = '';
|
||||
@@ -47,9 +52,17 @@ export class MegaMenuRenderer {
|
||||
|
||||
this.attachEventListeners();
|
||||
this.createScreenReaderAnnouncer();
|
||||
debugLog(this.debug, LOG_SOURCE, 'Render completed.', {
|
||||
navigationId: nav.id,
|
||||
topLevelElements: topLevelUl.children.length
|
||||
});
|
||||
}
|
||||
|
||||
public dispose(): void {
|
||||
debugLog(this.debug, LOG_SOURCE, 'Dispose started.', {
|
||||
hasContainer: !!this._container,
|
||||
hasAnnouncer: !!this._announcer
|
||||
});
|
||||
if (this._documentKeydownHandler) {
|
||||
document.removeEventListener('keydown', this._documentKeydownHandler);
|
||||
this._documentKeydownHandler = undefined;
|
||||
@@ -66,6 +79,7 @@ export class MegaMenuRenderer {
|
||||
this._container.innerHTML = '';
|
||||
}
|
||||
this._container = undefined;
|
||||
debugLog(this.debug, LOG_SOURCE, 'Dispose completed.');
|
||||
}
|
||||
|
||||
private createTopLevelItem(item: IMenuItem): HTMLLIElement {
|
||||
|
||||
Reference in New Issue
Block a user