Skip to content

Commit

Permalink
fix: On error callback added to packages/core/useScroll/index.ts, v…
Browse files Browse the repository at this point in the history
  • Loading branch information
steklopod committed Dec 4, 2023
1 parent 315d692 commit 974c177
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion packages/core/useScroll/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,13 @@ export interface UseScrollOptions extends ConfigurableWindow {
* @default 'auto'
*/
behavior?: MaybeRefOrGetter<ScrollBehavior>

/**
* On error callback
*
* Default log error to `console.error`
*/
onError?: (error: unknown) => void
}

/**
Expand Down Expand Up @@ -97,6 +104,7 @@ export function useScroll(
},
behavior = 'auto',
window = defaultWindow,
onError = (e) => { console.error(e) },
} = options

const internalX = ref(0)
Expand Down Expand Up @@ -258,7 +266,7 @@ export function useScroll(
setArrivedState(_element)
}
catch (e) {
// console.debug('Error setting ArrivedState for useScroll function')
onError(e)
}
})

Expand Down

0 comments on commit 974c177

Please sign in to comment.