Skip to content

Commit ad260aa

Browse files
adapt for init config changes
1 parent db5e1e8 commit ad260aa

2 files changed

Lines changed: 7 additions & 4 deletions

File tree

packages/browser-rum/src/domain/record/record.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ describe('record', () => {
7777
it('instruments canvas drawing when canvas recording is enabled', () => {
7878
const originalFillRect = Object.getOwnPropertyDescriptor(CanvasRenderingContext2D.prototype, 'fillRect')!.value
7979

80-
startRecording({ recordCanvas: true, canvasMaxFramesPerSecond: 1 })
80+
startRecording({ enableSessionReplayCanvasRecording: { maxFramesPerSecond: 1 } })
8181

8282
expect(Object.getOwnPropertyDescriptor(CanvasRenderingContext2D.prototype, 'fillRect')!.value).not.toBe(
8383
originalFillRect
@@ -87,7 +87,7 @@ describe('record', () => {
8787
it('does not instrument canvas drawing when canvas recording is disabled', () => {
8888
const originalFillRect = Object.getOwnPropertyDescriptor(CanvasRenderingContext2D.prototype, 'fillRect')!.value
8989

90-
startRecording({ recordCanvas: false, canvasMaxFramesPerSecond: 1 })
90+
startRecording()
9191

9292
expect(Object.getOwnPropertyDescriptor(CanvasRenderingContext2D.prototype, 'fillRect')!.value).toBe(
9393
originalFillRect
@@ -97,7 +97,7 @@ describe('record', () => {
9797
it('does not instrument canvas drawing when the maximum frame rate is zero', () => {
9898
const originalFillRect = Object.getOwnPropertyDescriptor(CanvasRenderingContext2D.prototype, 'fillRect')!.value
9999

100-
startRecording({ recordCanvas: true, canvasMaxFramesPerSecond: 0 })
100+
startRecording({ enableSessionReplayCanvasRecording: { maxFramesPerSecond: 0 } })
101101

102102
expect(Object.getOwnPropertyDescriptor(CanvasRenderingContext2D.prototype, 'fillRect')!.value).toBe(
103103
originalFillRect

packages/browser-rum/src/domain/record/record.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,10 @@ export function record(options: RecordOptions): RecordAPI {
7878
trackViewEnd(lifeCycle, processRecord, flushMutations),
7979
]
8080

81-
if (configuration.recordCanvas && configuration.canvasMaxFramesPerSecond > 0) {
81+
if (
82+
configuration.enableSessionReplayCanvasRecording &&
83+
configuration.enableSessionReplayCanvasRecording.maxFramesPerSecond > 0
84+
) {
8285
const canvasManager = createCanvasManager()
8386
trackers.push(trackCanvas2DMutations(canvasManager.markCanvasDirty))
8487
}

0 commit comments

Comments
 (0)