MCPcopy Index your code
hub / github.com/angular/angular / createScrollEvents

Method createScrollEvents

packages/router/src/router_scroller.ts:85–104  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

83 }
84
85 private createScrollEvents() {
86 return this.transitions.events.subscribe((e) => {
87 if (e instanceof NavigationStart) {
88 // store the scroll position of the current stable navigations.
89 this.store[this.lastId] = this.viewportScroller.getScrollPosition();
90 this.lastSource = e.navigationTrigger;
91 this.restoredId = e.restoredState ? e.restoredState.navigationId : 0;
92 } else if (e instanceof NavigationEnd) {
93 this.lastId = e.id;
94 this.scheduleScrollEvent(e, this.urlSerializer.parse(e.urlAfterRedirects).fragment);
95 } else if (
96 e instanceof NavigationSkipped &&
97 e.code === NavigationSkippedCode.IgnoredSameUrlNavigation
98 ) {
99 this.lastSource = undefined;
100 this.restoredId = 0;
101 this.scheduleScrollEvent(e, this.urlSerializer.parse(e.url).fragment);
102 }
103 });
104 }
105
106 private consumeScrollEvents() {
107 return this.transitions.events.subscribe((e) => {

Callers 1

initMethod · 0.95

Calls 4

scheduleScrollEventMethod · 0.95
subscribeMethod · 0.65
parseMethod · 0.65
getScrollPositionMethod · 0.45

Tested by

no test coverage detected