@@ -38,6 +38,7 @@ import { captureInternalException } from './util/captureInternalException';
38
38
import { createBreadcrumb } from './util/createBreadcrumb' ;
39
39
import { createPayload } from './util/createPayload' ;
40
40
import { dedupePerformanceEntries } from './util/dedupePerformanceEntries' ;
41
+ import { isBrowser } from './util/isBrowser' ;
41
42
import { isExpired } from './util/isExpired' ;
42
43
import { isSessionExpired } from './util/isSessionExpired' ;
43
44
@@ -53,8 +54,6 @@ const MEDIA_SELECTORS = 'img,image,svg,path,rect,area,video,object,picture,embed
53
54
54
55
let _initialized = false ;
55
56
56
- const isBrowser = typeof window !== 'undefined' ;
57
-
58
57
export class Replay implements Integration {
59
58
/**
60
59
* @inheritDoc
@@ -210,7 +209,7 @@ export class Replay implements Integration {
210
209
maxWait : this . options . flushMaxDelay ,
211
210
} ) ;
212
211
213
- if ( isBrowser && _initialized ) {
212
+ if ( isBrowser ( ) && _initialized ) {
214
213
const error = new Error ( 'Multiple Sentry Session Replay instances are not supported' ) ;
215
214
captureInternalException ( error ) ;
216
215
throw error ;
@@ -229,7 +228,7 @@ export class Replay implements Integration {
229
228
* here to avoid any future issues.
230
229
*/
231
230
setupOnce ( ) : void {
232
- if ( ! isBrowser ) {
231
+ if ( ! isBrowser ( ) ) {
233
232
return ;
234
233
}
235
234
// XXX: See method comments above
@@ -243,7 +242,7 @@ export class Replay implements Integration {
243
242
* PerformanceObserver, Recording, Sentry SDK, etc)
244
243
*/
245
244
start ( ) : void {
246
- if ( ! isBrowser ) {
245
+ if ( ! isBrowser ( ) ) {
247
246
return ;
248
247
}
249
248
@@ -309,7 +308,7 @@ export class Replay implements Integration {
309
308
* does not support a teardown
310
309
*/
311
310
stop ( ) : void {
312
- if ( ! isBrowser ) {
311
+ if ( ! isBrowser ( ) ) {
313
312
return ;
314
313
}
315
314
0 commit comments