Skip to content

Commit 216bf10

Browse files
authored
Merge pull request #74 from swup/fix/hook-arguments
Add hook args to `callSync` calls
2 parents d33e255 + b7b0c97 commit 216bf10

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/index.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ declare module 'swup' {
4444
}
4545

4646
export interface HookDefinitions {
47-
'scroll:start': {};
48-
'scroll:end': {};
47+
'scroll:start': undefined;
48+
'scroll:end': undefined;
4949
}
5050
}
5151

@@ -94,9 +94,9 @@ export default class SwupScrollPlugin extends Plugin {
9494

9595
// Initialize Scrl lib for smooth animations
9696
this.scrl = new Scrl({
97-
onStart: () => swup.hooks.callSync('scroll:start'),
98-
onEnd: () => swup.hooks.callSync('scroll:end'),
99-
onCancel: () => swup.hooks.callSync('scroll:end'),
97+
onStart: () => swup.hooks.callSync('scroll:start', undefined),
98+
onEnd: () => swup.hooks.callSync('scroll:end', undefined),
99+
onCancel: () => swup.hooks.callSync('scroll:end', undefined),
100100
friction: this.options.scrollFriction,
101101
acceleration: this.options.scrollAcceleration
102102
});
@@ -106,9 +106,9 @@ export default class SwupScrollPlugin extends Plugin {
106106
if (animate) {
107107
this.scrl.scrollTo(offset);
108108
} else {
109-
swup.hooks.callSync('scroll:start');
109+
swup.hooks.callSync('scroll:start', undefined);
110110
window.scrollTo(0, offset);
111-
swup.hooks.callSync('scroll:end');
111+
swup.hooks.callSync('scroll:end', undefined);
112112
}
113113
};
114114

0 commit comments

Comments
 (0)