Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
this._unlistenBefore = history.listenBefore(() => {
if (this._saveWindowPositionHandle !== null) {
requestAnimationFrame.cancel(this._saveWindowPositionHandle);
this._saveWindowPositionHandle = null;
}
// It's fine to save element scroll positions here, though; the browser
// won't modify them.
Object.keys(this._scrollElements).forEach(key => {
this._saveElementPosition(key);
});
});
}
Object.keys(this._scrollElements).forEach(key => {
const scrollElement = this._scrollElements[key];
requestAnimationFrame.cancel(scrollElement.savePositionHandle);
scrollElement.savePositionHandle = null;
// It's fine to save element scroll positions here, though; the browser
// won't modify them.
if (!this._ignoreScrollEvents) {
this._saveElementPosition(key);
}
});
});
this._removeTransitionHook = addTransitionHook(() => {
requestAnimationFrame.cancel(this._saveWindowPositionHandle);
this._saveWindowPositionHandle = null;
Object.keys(this._scrollElements).forEach(key => {
const scrollElement = this._scrollElements[key];
requestAnimationFrame.cancel(scrollElement.savePositionHandle);
scrollElement.savePositionHandle = null;
// It's fine to save element scroll positions here, though; the browser
// won't modify them.
if (!this._ignoreScrollEvents) {
this._saveElementPosition(key);
}
});
});
}
_cancelCheckWindowScroll() {
if (this._checkWindowScrollHandle !== null) {
requestAnimationFrame.cancel(this._checkWindowScrollHandle);
this._checkWindowScrollHandle = null;
}
}
function cancelCheckScroll() {
if (checkScrollHandle !== null) {
requestAnimationFrame.cancel(checkScrollHandle)
checkScrollHandle = null
}
}
_cancelCheckWindowScroll() {
requestAnimationFrame.cancel(this._checkWindowScrollHandle);
this._checkWindowScrollHandle = null;
}