add hooks API (#132)

This commit is contained in:
yz-yu
2019-09-17 23:33:38 +08:00
committed by GitHub
parent a5152de531
commit b64e1492ab
5 changed files with 150 additions and 69 deletions

View File

@@ -1,2 +1,2 @@
import { observerParam, listenerHandler } from '../types';
export default function initObservers(o: observerParam): listenerHandler;
import { observerParam, listenerHandler, hooksParam } from '../types';
export default function initObservers(o: observerParam, hooks?: hooksParam): listenerHandler;

10
typings/types.d.ts vendored
View File

@@ -88,6 +88,7 @@ export declare type recordOptions = {
ignoreClass?: string;
maskAllInputs?: boolean;
inlineStylesheet?: boolean;
hooks?: hooksParam;
};
export declare type observerParam = {
mutationCb: mutationCallBack;
@@ -101,6 +102,14 @@ export declare type observerParam = {
maskAllInputs: boolean;
inlineStylesheet: boolean;
};
export declare type hooksParam = {
mutation?: mutationCallBack;
mousemove?: mousemoveCallBack;
mouseInteraction?: mouseInteractionCallBack;
scroll?: scrollCallback;
viewportResize?: viewportResizeCallback;
input?: inputCallback;
};
export declare type textCursor = {
node: Node;
value: string | null;
@@ -225,6 +234,7 @@ export declare type Emitter = {
on(type: string, handler: Handler): void;
emit(type: string, event?: unknown): void;
};
export declare type Arguments<T> = T extends (...payload: infer U) => unknown ? U : unknown;
export declare enum ReplayerEvents {
Start = "start",
Pause = "pause",