Skip to content

Commit 55afb50

Browse files
committed
fix: only call onDone if it's defined
1 parent 0c0a297 commit 55afb50

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/scrollTo.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -162,8 +162,8 @@ export const scroller = () => {
162162
x = options.x === undefined ? defaults.x : options.x;
163163
y = options.y === undefined ? defaults.y : options.y;
164164

165-
var cumulativeOffsetContainer = _.cumulativeOffset(container);
166-
var cumulativeOffsetElement = _.cumulativeOffset(element);
165+
let cumulativeOffsetContainer = _.cumulativeOffset(container);
166+
let cumulativeOffsetElement = _.cumulativeOffset(element);
167167

168168
if (typeof offset === "function") {
169169
offset = offset(element, container);
@@ -212,7 +212,7 @@ export const scroller = () => {
212212
if (onStart) onStart(element);
213213

214214
if (!diffY && !diffX) {
215-
onDone(element);
215+
if (onDone) onDone(element);
216216
return;
217217
}
218218

0 commit comments

Comments
 (0)