Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/patch/window/scroll-by.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {handleScrollMethod} from "../shared";
* Patches the 'scrollBy' method on the Window prototype
*/
export function patchWindowScrollBy(): void {
window.scrollBy = function(this: Window, optionsOrX?: number | ScrollToOptions, y?: number): void {
handleScrollMethod(this, "scrollBy", optionsOrX, y);
window.scrollBy = function(this: Window | undefined, optionsOrX?: number | ScrollToOptions, y?: number): void {
handleScrollMethod(this ?? window, "scrollBy", optionsOrX, y);
};
}
4 changes: 2 additions & 2 deletions src/patch/window/scroll-to.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {handleScrollMethod} from "../shared";
* Patches the 'scrollTo' method on the Window prototype
*/
export function patchWindowScrollTo(): void {
window.scrollTo = function(this: Window, optionsOrX?: number | ScrollToOptions, y?: number): void {
handleScrollMethod(this, "scrollTo", optionsOrX, y);
window.scrollTo = function(this: Window | undefined, optionsOrX?: number | ScrollToOptions, y?: number): void {
handleScrollMethod(this ?? window, "scrollTo", optionsOrX, y);
};
}
4 changes: 2 additions & 2 deletions src/patch/window/scroll.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {handleScrollMethod} from "../shared";
* Patches the 'scroll' method on the Window prototype
*/
export function patchWindowScroll(): void {
window.scroll = function(this: Window, optionsOrX?: number | ScrollToOptions, y?: number): void {
handleScrollMethod(this, "scroll", optionsOrX, y);
window.scroll = function(this: Window | undefined, optionsOrX?: number | ScrollToOptions, y?: number): void {
handleScrollMethod(this ?? window, "scroll", optionsOrX, y);
};
}