Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
5 changes: 4 additions & 1 deletion packages/rrweb/src/record/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@
recordDOM = true,
recordCanvas = false,
recordCrossOriginIframes = false,
emitFromIframe = false,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since you could have more than one nested iframe that you want to record but will only ever have one parent, i wonder if it makes more sense to have a isParentIframe or isRootIframe instead

config then gets slightly simpler

recordAfter = options.recordAfter === 'DOMContentLoaded'
? options.recordAfter
: 'load',
Expand All @@ -103,7 +104,9 @@

registerErrorHandler(errorHandler);

const inEmittingFrame = recordCrossOriginIframes
const inEmittingFrame = emitFromIframe
? true
: recordCrossOriginIframes
? window.parent === window
: true;

Expand Down Expand Up @@ -557,7 +560,7 @@
plugins
?.filter((p) => p.observer)
?.map((p) => ({
observer: p.observer!,

Check warning on line 563 in packages/rrweb/src/record/index.ts

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

packages/rrweb/src/record/index.ts#L563

[@typescript-eslint/no-non-null-assertion] Forbidden non-null assertion.
options: p.options,
callback: (payload: object) =>
wrappedEmit({
Expand All @@ -575,7 +578,7 @@

iframeManager.addLoadListener((iframeEl) => {
try {
handlers.push(observe(iframeEl.contentDocument!));

Check warning on line 581 in packages/rrweb/src/record/index.ts

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

packages/rrweb/src/record/index.ts#L581

[@typescript-eslint/no-non-null-assertion] Forbidden non-null assertion.
} catch (error) {
// TODO: handle internal error
console.warn(error);
Expand Down
1 change: 1 addition & 0 deletions packages/rrweb/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ export type recordOptions<T> = {
recordDOM?: boolean;
recordCanvas?: boolean;
recordCrossOriginIframes?: boolean;
emitFromIframe?: boolean;
recordAfter?: 'DOMContentLoaded' | 'load';
userTriggeredOnInput?: boolean;
collectFonts?: boolean;
Expand Down
Loading