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 authored Jul 28, 2023
1 parent 1a07a00 commit 7d8da02
Show file tree
Hide file tree
Showing 3 changed files with 197 additions and 165 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 @@ -320,6 +320,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 @@ -668,6 +669,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 7d8da02

Please sign in to comment.