Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(replay): Rename isManualSnapshot to enableManualSnapshot #158

Merged
merged 2 commits into from
Jan 16, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions packages/rrweb/src/record/observers/canvas/canvas-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@

export interface CanvasManagerConstructorOptions {
recordCanvas: boolean;
isManualSnapshot?: boolean;
enableManualSnapshot?: boolean;
mutationCb: canvasMutationCallback;
win: IWindow;
blockClass: blockClass;
Expand Down Expand Up @@ -118,7 +118,7 @@
this.mirror = options.mirror;
this.options = options;

if (options.isManualSnapshot) {
if (options.enableManualSnapshot) {
return;
}

Expand Down Expand Up @@ -158,7 +158,7 @@
this.pendingCanvasMutations.set(target, []);
}

this.pendingCanvasMutations.get(target)!.push(mutation);

Check warning on line 161 in packages/rrweb/src/record/observers/canvas/canvas-manager.ts

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

packages/rrweb/src/record/observers/canvas/canvas-manager.ts#L161

[@typescript-eslint/no-non-null-assertion] Forbidden non-null assertion.
};

private initCanvasFPSObserver(
Expand Down Expand Up @@ -235,6 +235,7 @@
}

public snapshot(canvasElement?: HTMLCanvasElement) {
console.log('manual snapshot');
c298lee marked this conversation as resolved.
Show resolved Hide resolved
const { options } = this;
const rafId = this.takeSnapshot(
true,
Expand All @@ -253,7 +254,7 @@
}

private takeSnapshot(
isManualSnapshot: boolean,
enableManualSnapshot: boolean,
c298lee marked this conversation as resolved.
Show resolved Hide resolved
fps: number,
win: IWindow,
blockClass: blockClass,
Expand Down Expand Up @@ -338,7 +339,7 @@
if (snapshotInProgressMap.get(id)) return;
snapshotInProgressMap.set(id, true);
if (
!isManualSnapshot &&
!enableManualSnapshot &&
['webgl', 'webgl2'].includes((canvas as ICanvas).__context)
) {
// if the canvas hasn't been modified recently,
Expand Down Expand Up @@ -420,7 +421,7 @@
if (!valuesWithType || id === -1) return;

const values = valuesWithType.map((value) => {
const { type, ...rest } = value;

Check warning on line 424 in packages/rrweb/src/record/observers/canvas/canvas-manager.ts

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

packages/rrweb/src/record/observers/canvas/canvas-manager.ts#L424

[@typescript-eslint/no-unused-vars] 'type' is assigned a value but never used.
return rest;
});
const { type } = valuesWithType[0];
Expand Down
Loading