Skip to content

Commit

Permalink
support manual canvas snapshotting (#108)
Browse files Browse the repository at this point in the history
  • Loading branch information
Vadman97 committed Apr 17, 2024
1 parent 054fc07 commit 8991d5d
Show file tree
Hide file tree
Showing 3 changed files with 196 additions and 179 deletions.
8 changes: 8 additions & 0 deletions packages/rrweb/src/record/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,7 @@ function record<T = eventWithTime>(
blockSelector,
mirror,
sampling: sampling?.canvas?.fps,
samplingManual: sampling?.canvas?.fpsManual,
clearWebGLBuffer: sampling?.canvas?.clearWebGLBuffer,
initialSnapshotDelay: sampling?.canvas?.initialSnapshotDelay,
dataURLOptions,
Expand Down Expand Up @@ -687,6 +688,13 @@ record.takeFullSnapshot = (isCheckout?: boolean) => {
takeFullSnapshot(isCheckout);
};

record.snapshotCanvas = async (element: HTMLCanvasElement) => {
if (!canvasManager) {
throw new Error('canvas manager is not initialized');
}
await canvasManager.snapshot(element);
};

record.mirror = mirror;

export default record;
Loading

0 comments on commit 8991d5d

Please sign in to comment.