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 Sep 9, 2024
1 parent c2dfff1 commit b7caf12
Show file tree
Hide file tree
Showing 3 changed files with 209 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 @@ -331,6 +331,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 @@ -669,6 +670,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 b7caf12

Please sign in to comment.