Release 0.9.1

This commit is contained in:
Yanzhen Yu
2020-09-07 09:47:17 +08:00
parent 9b8c7f755f
commit c8094c33dc
5 changed files with 26 additions and 4 deletions

View File

@@ -1,6 +1,6 @@
{ {
"name": "rrweb", "name": "rrweb",
"version": "0.9.0", "version": "0.9.1",
"description": "record and replay the web", "description": "record and replay the web",
"scripts": { "scripts": {
"test": "npm run bundle:browser && cross-env TS_NODE_CACHE=false TS_NODE_FILES=true mocha -r ts-node/register test/**/*.test.ts", "test": "npm run bundle:browser && cross-env TS_NODE_CACHE=false TS_NODE_FILES=true mocha -r ts-node/register test/**/*.test.ts",

View File

@@ -13,7 +13,8 @@ export default class MutationBuffer {
private blockClass; private blockClass;
private inlineStylesheet; private inlineStylesheet;
private maskInputOptions; private maskInputOptions;
constructor(cb: mutationCallBack, blockClass: blockClass, inlineStylesheet: boolean, maskInputOptions: MaskInputOptions); private recordCanvas;
constructor(cb: mutationCallBack, blockClass: blockClass, inlineStylesheet: boolean, maskInputOptions: MaskInputOptions, recordCanvas: boolean);
processMutations: (mutations: mutationRecord[]) => void; processMutations: (mutations: mutationRecord[]) => void;
emit: () => void; emit: () => void;
private processMutation; private processMutation;

View File

@@ -15,6 +15,7 @@ export declare class Replayer {
private legacy_missingNodeRetryMap; private legacy_missingNodeRetryMap;
private treeIndex; private treeIndex;
private fragmentParentMap; private fragmentParentMap;
private imageMap;
constructor(events: Array<eventWithTime | string>, config?: Partial<playerConfig>); constructor(events: Array<eventWithTime | string>, config?: Partial<playerConfig>);
on(event: string, handler: Handler): void; on(event: string, handler: Handler): void;
setConfig(config: Partial<playerConfig>): void; setConfig(config: Partial<playerConfig>): void;
@@ -33,6 +34,7 @@ export declare class Replayer {
private getCastFn; private getCastFn;
private rebuildFullSnapshot; private rebuildFullSnapshot;
private waitForStylesheetLoad; private waitForStylesheetLoad;
private preloadAllImages;
private applyIncremental; private applyIncremental;
private applyMutation; private applyMutation;
private applyScroll; private applyScroll;
@@ -43,5 +45,6 @@ export declare class Replayer {
private isUserInteraction; private isUserInteraction;
private backToNormal; private backToNormal;
private warnNodeNotFound; private warnNodeNotFound;
private warnCanvasMutationFailed;
private debugNodeNotFound; private debugNodeNotFound;
} }

View File

@@ -12,6 +12,7 @@ export declare class Timer {
clear(): void; clear(): void;
setSpeed(speed: number): void; setSpeed(speed: number): void;
toggleLiveMode(mode: boolean): void; toggleLiveMode(mode: boolean): void;
isActive(): boolean;
private findActionIndex; private findActionIndex;
} }
export declare function addDelay(event: eventWithTime, baselineTime: number): number; export declare function addDelay(event: eventWithTime, baselineTime: number): number;

21
typings/types.d.ts vendored
View File

@@ -55,7 +55,8 @@ export declare enum IncrementalSource {
Input = 5, Input = 5,
TouchMove = 6, TouchMove = 6,
MediaInteraction = 7, MediaInteraction = 7,
StyleSheetRule = 8 StyleSheetRule = 8,
CanvasMutation = 9
} }
export declare type mutationData = { export declare type mutationData = {
source: IncrementalSource.Mutation; source: IncrementalSource.Mutation;
@@ -83,7 +84,10 @@ export declare type mediaInteractionData = {
export declare type styleSheetRuleData = { export declare type styleSheetRuleData = {
source: IncrementalSource.StyleSheetRule; source: IncrementalSource.StyleSheetRule;
} & styleSheetRuleParam; } & styleSheetRuleParam;
export declare type incrementalData = mutationData | mousemoveData | mouseInteractionData | scrollData | viewportResizeData | inputData | mediaInteractionData | styleSheetRuleData; export declare type canvasMutationData = {
source: IncrementalSource.CanvasMutation;
} & canvasMutationParam;
export declare type incrementalData = mutationData | mousemoveData | mouseInteractionData | scrollData | viewportResizeData | inputData | mediaInteractionData | styleSheetRuleData | canvasMutationData;
export declare type event = domContentLoadedEvent | loadedEvent | fullSnapshotEvent | incrementalSnapshotEvent | metaEvent | customEvent; export declare type event = domContentLoadedEvent | loadedEvent | fullSnapshotEvent | incrementalSnapshotEvent | metaEvent | customEvent;
export declare type eventWithTime = event & { export declare type eventWithTime = event & {
timestamp: number; timestamp: number;
@@ -108,6 +112,7 @@ export declare type recordOptions<T> = {
hooks?: hooksParam; hooks?: hooksParam;
packFn?: PackFn; packFn?: PackFn;
sampling?: SamplingStrategy; sampling?: SamplingStrategy;
recordCanvas?: boolean;
mousemoveWait?: number; mousemoveWait?: number;
}; };
export declare type observerParam = { export declare type observerParam = {
@@ -123,7 +128,9 @@ export declare type observerParam = {
maskInputOptions: MaskInputOptions; maskInputOptions: MaskInputOptions;
inlineStylesheet: boolean; inlineStylesheet: boolean;
styleSheetRuleCb: styleSheetRuleCallback; styleSheetRuleCb: styleSheetRuleCallback;
canvasMutationCb: canvasMutationCallback;
sampling: SamplingStrategy; sampling: SamplingStrategy;
recordCanvas: boolean;
}; };
export declare type hooksParam = { export declare type hooksParam = {
mutation?: mutationCallBack; mutation?: mutationCallBack;
@@ -134,6 +141,7 @@ export declare type hooksParam = {
input?: inputCallback; input?: inputCallback;
mediaInteaction?: mediaInteractionCallback; mediaInteaction?: mediaInteractionCallback;
styleSheetRule?: styleSheetRuleCallback; styleSheetRule?: styleSheetRuleCallback;
canvasMutation?: canvasMutationCallback;
}; };
export declare type mutationRecord = { export declare type mutationRecord = {
type: string; type: string;
@@ -225,6 +233,13 @@ export declare type styleSheetRuleParam = {
adds?: styleSheetAddRule[]; adds?: styleSheetAddRule[];
}; };
export declare type styleSheetRuleCallback = (s: styleSheetRuleParam) => void; export declare type styleSheetRuleCallback = (s: styleSheetRuleParam) => void;
export declare type canvasMutationCallback = (p: canvasMutationParam) => void;
export declare type canvasMutationParam = {
id: number;
property: string;
args: Array<unknown>;
setter?: true;
};
export declare type viewportResizeDimention = { export declare type viewportResizeDimention = {
width: number; width: number;
height: number; height: number;
@@ -270,6 +285,7 @@ export declare type playerConfig = {
liveMode: boolean; liveMode: boolean;
insertStyleRules: string[]; insertStyleRules: string[];
triggerFocus: boolean; triggerFocus: boolean;
UNSAFE_replayCanvas: boolean;
unpackFn?: UnpackFn; unpackFn?: UnpackFn;
}; };
export declare type playerMetaData = { export declare type playerMetaData = {
@@ -292,6 +308,7 @@ export declare type Handler = (event?: unknown) => void;
export declare type Emitter = { export declare type Emitter = {
on(type: string, handler: Handler): void; on(type: string, handler: Handler): void;
emit(type: string, event?: unknown): void; emit(type: string, event?: unknown): void;
off(type: string, handler: Handler): void;
}; };
export declare type Arguments<T> = T extends (...payload: infer U) => unknown ? U : unknown; export declare type Arguments<T> = T extends (...payload: infer U) => unknown ? U : unknown;
export declare enum ReplayerEvents { export declare enum ReplayerEvents {