diff --git a/src/record/index.ts b/src/record/index.ts index 805782dc..027af83e 100644 --- a/src/record/index.ts +++ b/src/record/index.ts @@ -35,6 +35,7 @@ function record(options: recordOptions = {}): listenerHandler | undefined { inlineStylesheet = true, maskAllInputs = false, hooks, + mousemoveWait = 50 } = options; // runtime checks for user options if (!emit) { @@ -181,6 +182,7 @@ function record(options: recordOptions = {}): listenerHandler | undefined { ignoreClass, maskAllInputs, inlineStylesheet, + mousemoveWait }, hooks, ), diff --git a/src/record/observer.ts b/src/record/observer.ts index a6b130f0..c94aa735 100644 --- a/src/record/observer.ts +++ b/src/record/observer.ts @@ -279,7 +279,7 @@ function initMutationObserver( return observer; } -function initMoveObserver(cb: mousemoveCallBack): listenerHandler { +function initMoveObserver(cb: mousemoveCallBack, mousemoveWait: number): listenerHandler { let positions: mousePosition[] = []; let timeBaseline: number | null; const wrappedCb = throttle((isTouch: boolean) => { @@ -311,7 +311,7 @@ function initMoveObserver(cb: mousemoveCallBack): listenerHandler { }); wrappedCb(isTouchEvent(evt)); }, - 50, + mousemoveWait, { trailing: false, }, @@ -570,7 +570,7 @@ export default function initObservers( o.inlineStylesheet, o.maskAllInputs, ); - const mousemoveHandler = initMoveObserver(o.mousemoveCb); + const mousemoveHandler = initMoveObserver(o.mousemoveCb, o.mousemoveWait); const mouseInteractionHandler = initMouseInteractionObserver( o.mouseInteractionCb, o.blockClass, diff --git a/src/types.ts b/src/types.ts index dd39cc62..44621399 100644 --- a/src/types.ts +++ b/src/types.ts @@ -120,6 +120,7 @@ export type recordOptions = { maskAllInputs?: boolean; inlineStylesheet?: boolean; hooks?: hooksParam; + mousemoveWait?: number; }; export type observerParam = { @@ -133,6 +134,7 @@ export type observerParam = { ignoreClass: string; maskAllInputs: boolean; inlineStylesheet: boolean; + mousemoveWait: number; }; export type hooksParam = {