Skip to content

Commit 9c68c30

Browse files
eoghanmurraybillyvg
authored andcommitted
perf: Avoid an extra function call and object clone during event emission (rrweb-io#1441)
performance: remove a nested function call and an object clone during event emission - rename `event` to `eventWithoutTime`, but maintain backwards compatibility - `eventWithTime` (with time) could be renamed to `event` in a future version This is an extension of PR rrweb-io#1339 authored by: mydea <mydea@users.noreply.github.com>
1 parent 9e07245 commit 9c68c30

5 files changed

Lines changed: 154 additions & 173 deletions

File tree

.changeset/event-single-wrap.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'rrweb': patch
3+
---
4+
5+
perf: Avoid an extra function call and object clone during event emission

packages/rrweb/src/record/iframe-manager.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import CrossOriginIframeMirror from './cross-origin-iframe-mirror';
88
import { EventType, IncrementalSource } from '@sentry-internal/rrweb-types';
99
import type {
1010
eventWithTime,
11+
eventWithoutTime,
1112
mutationCallBack,
1213
} from '@sentry-internal/rrweb-types';
1314
import type { StylesheetManager } from './stylesheet-manager';
@@ -52,7 +53,7 @@ export class IframeManager implements IframeManagerInterface {
5253
new WeakMap();
5354
private mirror: Mirror;
5455
private mutationCb: mutationCallBack;
55-
private wrappedEmit: (e: eventWithTime, isCheckout?: boolean) => void;
56+
private wrappedEmit: (e: eventWithoutTime, isCheckout?: boolean) => void;
5657
private loadListener?: (iframeEl: HTMLIFrameElement) => unknown;
5758
private stylesheetManager: StylesheetManager;
5859
private recordCrossOriginIframes: boolean;
@@ -62,7 +63,7 @@ export class IframeManager implements IframeManagerInterface {
6263
mutationCb: mutationCallBack;
6364
stylesheetManager: StylesheetManager;
6465
recordCrossOriginIframes: boolean;
65-
wrappedEmit: (e: eventWithTime, isCheckout?: boolean) => void;
66+
wrappedEmit: (e: eventWithoutTime, isCheckout?: boolean) => void;
6667
}) {
6768
this.mutationCb = options.mutationCb;
6869
this.wrappedEmit = options.wrappedEmit;

0 commit comments

Comments
 (0)