@@ -38,6 +38,7 @@ import { captureInternalException } from './util/captureInternalException';
3838import { createBreadcrumb } from './util/createBreadcrumb' ;
3939import { createPayload } from './util/createPayload' ;
4040import { dedupePerformanceEntries } from './util/dedupePerformanceEntries' ;
41+ import { isBrowser } from './util/isBrowser' ;
4142import { isExpired } from './util/isExpired' ;
4243import { isSessionExpired } from './util/isSessionExpired' ;
4344
@@ -53,8 +54,6 @@ const MEDIA_SELECTORS = 'img,image,svg,path,rect,area,video,object,picture,embed
5354
5455let _initialized = false ;
5556
56- const isBrowser = typeof window !== 'undefined' ;
57-
5857export class Replay implements Integration {
5958 /**
6059 * @inheritDoc
@@ -210,7 +209,7 @@ export class Replay implements Integration {
210209 maxWait : this . options . flushMaxDelay ,
211210 } ) ;
212211
213- if ( isBrowser && _initialized ) {
212+ if ( isBrowser ( ) && _initialized ) {
214213 const error = new Error ( 'Multiple Sentry Session Replay instances are not supported' ) ;
215214 captureInternalException ( error ) ;
216215 throw error ;
@@ -229,7 +228,7 @@ export class Replay implements Integration {
229228 * here to avoid any future issues.
230229 */
231230 setupOnce ( ) : void {
232- if ( ! isBrowser ) {
231+ if ( ! isBrowser ( ) ) {
233232 return ;
234233 }
235234 // XXX: See method comments above
@@ -243,7 +242,7 @@ export class Replay implements Integration {
243242 * PerformanceObserver, Recording, Sentry SDK, etc)
244243 */
245244 start ( ) : void {
246- if ( ! isBrowser ) {
245+ if ( ! isBrowser ( ) ) {
247246 return ;
248247 }
249248
@@ -309,7 +308,7 @@ export class Replay implements Integration {
309308 * does not support a teardown
310309 */
311310 stop ( ) : void {
312- if ( ! isBrowser ) {
311+ if ( ! isBrowser ( ) ) {
313312 return ;
314313 }
315314
0 commit comments