Added mousemoveCallback threshold option to sampling config. (#492)
* Added mousemoveCallback threshold option to sampling config. * Added mousemoveCallback to definitions file.
This commit is contained in:
committed by
GitHub
parent
d2f18fa03d
commit
eeac998959
@@ -131,6 +131,8 @@ function initMoveObserver(
|
|||||||
|
|
||||||
const threshold =
|
const threshold =
|
||||||
typeof sampling.mousemove === 'number' ? sampling.mousemove : 50;
|
typeof sampling.mousemove === 'number' ? sampling.mousemove : 50;
|
||||||
|
const callbackThreshold =
|
||||||
|
typeof sampling.mousemoveCallback === 'number' ? sampling.mousemoveCallback : 500;
|
||||||
|
|
||||||
let positions: mousePosition[] = [];
|
let positions: mousePosition[] = [];
|
||||||
let timeBaseline: number | null;
|
let timeBaseline: number | null;
|
||||||
@@ -145,7 +147,7 @@ function initMoveObserver(
|
|||||||
);
|
);
|
||||||
positions = [];
|
positions = [];
|
||||||
timeBaseline = null;
|
timeBaseline = null;
|
||||||
}, 500);
|
}, callbackThreshold);
|
||||||
const updatePosition = throttle<MouseEvent | TouchEvent>(
|
const updatePosition = throttle<MouseEvent | TouchEvent>(
|
||||||
(evt) => {
|
(evt) => {
|
||||||
const { target } = evt;
|
const { target } = evt;
|
||||||
|
|||||||
@@ -164,6 +164,10 @@ export type SamplingStrategy = Partial<{
|
|||||||
* number is the throttle threshold of recording mouse/touch move
|
* number is the throttle threshold of recording mouse/touch move
|
||||||
*/
|
*/
|
||||||
mousemove: boolean | number;
|
mousemove: boolean | number;
|
||||||
|
/**
|
||||||
|
* number is the throttle threshold of mouse/touch move callback
|
||||||
|
*/
|
||||||
|
mousemoveCallback: number;
|
||||||
/**
|
/**
|
||||||
* false means not to record mouse interaction events
|
* false means not to record mouse interaction events
|
||||||
* can also specify record some kinds of mouse interactions
|
* can also specify record some kinds of mouse interactions
|
||||||
|
|||||||
1
typings/types.d.ts
vendored
1
typings/types.d.ts
vendored
@@ -111,6 +111,7 @@ export declare type eventWithTime = event & {
|
|||||||
export declare type blockClass = string | RegExp;
|
export declare type blockClass = string | RegExp;
|
||||||
export declare type SamplingStrategy = Partial<{
|
export declare type SamplingStrategy = Partial<{
|
||||||
mousemove: boolean | number;
|
mousemove: boolean | number;
|
||||||
|
mousemoveCallback: number;
|
||||||
mouseInteraction: boolean | Record<string, boolean | undefined>;
|
mouseInteraction: boolean | Record<string, boolean | undefined>;
|
||||||
scroll: number;
|
scroll: number;
|
||||||
input: 'all' | 'last';
|
input: 'all' | 'last';
|
||||||
|
|||||||
Reference in New Issue
Block a user