Skip to content

Commit

Permalink
Merge pull request #16 from pendo-io/meg-define-take-full-snapshot-be…
Browse files Browse the repository at this point in the history
…fore-use

define takeFullSnapshot before use in iframeManager constructor to prevent undefined error
  • Loading branch information
colingm authored May 16, 2024
2 parents 168e606 + 86b9b3b commit c504a11
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
4 changes: 4 additions & 0 deletions packages/rrweb/src/record/iframe-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ export class IframeManager {
}
}

public setTakeFullSnapshot(takeFullSnapshot: (isCheckout?: boolean) => void) {
this.takeFullSnapshot = takeFullSnapshot;
}

public addIframe(iframeEl: HTMLIFrameElement) {
this.iframes.set(iframeEl, true);
if (iframeEl.contentWindow)
Expand Down
6 changes: 4 additions & 2 deletions packages/rrweb/src/record/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,9 @@ import {
} from './error-handler';

let wrappedEmit!: (e: eventWithoutTime, isCheckout?: boolean) => void;

let takeFullSnapshot!: (isCheckout?: boolean) => void;
let takeFullSnapshot: (isCheckout?: boolean) => void = () => {
/* no-op */
};
let canvasManager!: CanvasManager;
let recording = false;

Expand Down Expand Up @@ -418,6 +419,7 @@ function record<T = eventWithTime>(
mirror.getId(document),
);
};
iframeManager.setTakeFullSnapshot(takeFullSnapshot);

try {
const handlers: listenerHandler[] = [];
Expand Down

0 comments on commit c504a11

Please sign in to comment.