mirror of
https://github.com/Redocly/redoc.git
synced 2025-03-03 17:35:46 +03:00
fix: menu service subscription leak + minor refactor
This commit is contained in:
parent
9ea672d921
commit
bb00dc3426
|
@ -35,7 +35,7 @@ export interface MenuItem {
|
||||||
active?: boolean;
|
active?: boolean;
|
||||||
ready?: boolean;
|
ready?: boolean;
|
||||||
|
|
||||||
depth?: number;
|
depth?: string|number;
|
||||||
flatIdx?: number;
|
flatIdx?: number;
|
||||||
|
|
||||||
metadata?: any;
|
metadata?: any;
|
||||||
|
@ -72,7 +72,11 @@ export class MenuService {
|
||||||
this.buildMenu();
|
this.buildMenu();
|
||||||
});
|
});
|
||||||
|
|
||||||
this._scrollSubscription = scrollService.scroll.subscribe((evt) => {
|
this.subscribe();
|
||||||
|
}
|
||||||
|
|
||||||
|
subscribe() {
|
||||||
|
this._scrollSubscription = this.scrollService.scroll.subscribe((evt) => {
|
||||||
this.onScroll(evt.isScrolledDown);
|
this.onScroll(evt.isScrolledDown);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -478,5 +482,6 @@ export class MenuService {
|
||||||
destroy() {
|
destroy() {
|
||||||
this._hashSubscription.unsubscribe();
|
this._hashSubscription.unsubscribe();
|
||||||
this._scrollSubscription.unsubscribe();
|
this._scrollSubscription.unsubscribe();
|
||||||
|
this._progressSubscription.unsubscribe();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user