()
| 104 | } |
| 105 | |
| 106 | private consumeScrollEvents() { |
| 107 | return this.transitions.events.subscribe((e) => { |
| 108 | if (!(e instanceof Scroll) || e.scrollBehavior === 'manual') return; |
| 109 | const instantScroll: ScrollOptions = {behavior: 'instant'}; |
| 110 | // a popstate event. The pop state event will always ignore anchor scrolling. |
| 111 | if (e.position) { |
| 112 | if (this.options.scrollPositionRestoration === 'top') { |
| 113 | this.viewportScroller.scrollToPosition([0, 0], instantScroll); |
| 114 | } else if (this.options.scrollPositionRestoration === 'enabled') { |
| 115 | this.viewportScroller.scrollToPosition(e.position, instantScroll); |
| 116 | } |
| 117 | // imperative navigation "forward" |
| 118 | } else { |
| 119 | if (e.anchor && this.options.anchorScrolling === 'enabled') { |
| 120 | this.viewportScroller.scrollToAnchor(e.anchor); |
| 121 | } else if (this.options.scrollPositionRestoration !== 'disabled') { |
| 122 | this.viewportScroller.scrollToPosition([0, 0]); |
| 123 | } |
| 124 | } |
| 125 | }); |
| 126 | } |
| 127 | |
| 128 | private scheduleScrollEvent( |
| 129 | routerEvent: NavigationEnd | NavigationSkipped, |
no test coverage detected