add mouse interactions observer
This commit is contained in:
39
src/types.ts
39
src/types.ts
@@ -34,6 +34,7 @@ export type incrementalSnapshotEvent = {
|
||||
export enum IncrementalSource {
|
||||
Mutation,
|
||||
MouseMove,
|
||||
MouseInteraction,
|
||||
}
|
||||
|
||||
export type mutationData = {
|
||||
@@ -45,7 +46,14 @@ export type mousemoveData = {
|
||||
positions: mousePosition[];
|
||||
};
|
||||
|
||||
export type incrementalData = mutationData | mousemoveData;
|
||||
export type mouseInteractionData = {
|
||||
source: IncrementalSource.MouseInteraction;
|
||||
} & mouseInteractionParam;
|
||||
|
||||
export type incrementalData =
|
||||
| mutationData
|
||||
| mousemoveData
|
||||
| mouseInteractionData;
|
||||
|
||||
export type event =
|
||||
| domContentLoadedEvent
|
||||
@@ -64,6 +72,7 @@ export type recordOptions = {
|
||||
export type observerParam = {
|
||||
mutationCb: mutationCallBack;
|
||||
mousemoveCb: mousemoveCallBack;
|
||||
mouseInteractionCb: mouseInteractionCallBack;
|
||||
};
|
||||
|
||||
export type textMutation = {
|
||||
@@ -99,7 +108,7 @@ type mutationCallbackParam = {
|
||||
|
||||
export type mutationCallBack = (m: mutationCallbackParam) => void;
|
||||
|
||||
export type mousemoveCallBack = (m: mousePosition[]) => void;
|
||||
export type mousemoveCallBack = (p: mousePosition[]) => void;
|
||||
|
||||
export type mousePosition = {
|
||||
x: number;
|
||||
@@ -107,6 +116,32 @@ export type mousePosition = {
|
||||
timeOffset: number;
|
||||
};
|
||||
|
||||
export type handlerMap = {
|
||||
[key: string]: EventListener;
|
||||
};
|
||||
|
||||
export enum MouseInteractions {
|
||||
MouseUp,
|
||||
MouseDown,
|
||||
Click,
|
||||
ContextMenu,
|
||||
DblClick,
|
||||
Focus,
|
||||
Blur,
|
||||
TouchStart,
|
||||
TouchMove,
|
||||
TouchEnd,
|
||||
}
|
||||
|
||||
type mouseInteractionParam = {
|
||||
type: MouseInteractions;
|
||||
id: number;
|
||||
x: number;
|
||||
y: number;
|
||||
};
|
||||
|
||||
export type mouseInteractionCallBack = (d: mouseInteractionParam) => void;
|
||||
|
||||
export type Mirror = {
|
||||
map: idNodeMap;
|
||||
getId: (n: INode) => number;
|
||||
|
||||
Reference in New Issue
Block a user