diff --git a/package.json b/package.json index aa01b99b..1fcd2b15 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "rrweb", - "version": "0.9.0", + "version": "0.9.1", "description": "record and replay the web", "scripts": { "test": "npm run bundle:browser && cross-env TS_NODE_CACHE=false TS_NODE_FILES=true mocha -r ts-node/register test/**/*.test.ts", diff --git a/typings/record/mutation.d.ts b/typings/record/mutation.d.ts index 8350ee19..9d92fd20 100644 --- a/typings/record/mutation.d.ts +++ b/typings/record/mutation.d.ts @@ -13,7 +13,8 @@ export default class MutationBuffer { private blockClass; private inlineStylesheet; 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; emit: () => void; private processMutation; diff --git a/typings/replay/index.d.ts b/typings/replay/index.d.ts index 5d0551b9..30a733c3 100644 --- a/typings/replay/index.d.ts +++ b/typings/replay/index.d.ts @@ -15,6 +15,7 @@ export declare class Replayer { private legacy_missingNodeRetryMap; private treeIndex; private fragmentParentMap; + private imageMap; constructor(events: Array, config?: Partial); on(event: string, handler: Handler): void; setConfig(config: Partial): void; @@ -33,6 +34,7 @@ export declare class Replayer { private getCastFn; private rebuildFullSnapshot; private waitForStylesheetLoad; + private preloadAllImages; private applyIncremental; private applyMutation; private applyScroll; @@ -43,5 +45,6 @@ export declare class Replayer { private isUserInteraction; private backToNormal; private warnNodeNotFound; + private warnCanvasMutationFailed; private debugNodeNotFound; } diff --git a/typings/replay/timer.d.ts b/typings/replay/timer.d.ts index f15aefa8..376c9249 100644 --- a/typings/replay/timer.d.ts +++ b/typings/replay/timer.d.ts @@ -12,6 +12,7 @@ export declare class Timer { clear(): void; setSpeed(speed: number): void; toggleLiveMode(mode: boolean): void; + isActive(): boolean; private findActionIndex; } export declare function addDelay(event: eventWithTime, baselineTime: number): number; diff --git a/typings/types.d.ts b/typings/types.d.ts index 58fad2fd..ca668327 100644 --- a/typings/types.d.ts +++ b/typings/types.d.ts @@ -55,7 +55,8 @@ export declare enum IncrementalSource { Input = 5, TouchMove = 6, MediaInteraction = 7, - StyleSheetRule = 8 + StyleSheetRule = 8, + CanvasMutation = 9 } export declare type mutationData = { source: IncrementalSource.Mutation; @@ -83,7 +84,10 @@ export declare type mediaInteractionData = { export declare type styleSheetRuleData = { source: IncrementalSource.StyleSheetRule; } & 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 eventWithTime = event & { timestamp: number; @@ -108,6 +112,7 @@ export declare type recordOptions = { hooks?: hooksParam; packFn?: PackFn; sampling?: SamplingStrategy; + recordCanvas?: boolean; mousemoveWait?: number; }; export declare type observerParam = { @@ -123,7 +128,9 @@ export declare type observerParam = { maskInputOptions: MaskInputOptions; inlineStylesheet: boolean; styleSheetRuleCb: styleSheetRuleCallback; + canvasMutationCb: canvasMutationCallback; sampling: SamplingStrategy; + recordCanvas: boolean; }; export declare type hooksParam = { mutation?: mutationCallBack; @@ -134,6 +141,7 @@ export declare type hooksParam = { input?: inputCallback; mediaInteaction?: mediaInteractionCallback; styleSheetRule?: styleSheetRuleCallback; + canvasMutation?: canvasMutationCallback; }; export declare type mutationRecord = { type: string; @@ -225,6 +233,13 @@ export declare type styleSheetRuleParam = { adds?: styleSheetAddRule[]; }; export declare type styleSheetRuleCallback = (s: styleSheetRuleParam) => void; +export declare type canvasMutationCallback = (p: canvasMutationParam) => void; +export declare type canvasMutationParam = { + id: number; + property: string; + args: Array; + setter?: true; +}; export declare type viewportResizeDimention = { width: number; height: number; @@ -270,6 +285,7 @@ export declare type playerConfig = { liveMode: boolean; insertStyleRules: string[]; triggerFocus: boolean; + UNSAFE_replayCanvas: boolean; unpackFn?: UnpackFn; }; export declare type playerMetaData = { @@ -292,6 +308,7 @@ export declare type Handler = (event?: unknown) => void; export declare type Emitter = { on(type: string, handler: Handler): void; emit(type: string, event?: unknown): void; + off(type: string, handler: Handler): void; }; export declare type Arguments = T extends (...payload: infer U) => unknown ? U : unknown; export declare enum ReplayerEvents {