Skip to content

Commit

Permalink
feat: send custom event when network status changes (#965)
Browse files Browse the repository at this point in the history
  • Loading branch information
pauldambra authored Jan 24, 2024
1 parent 9fef5f6 commit fbe8ae5
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/extensions/replay/sessionrecording.ts
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,14 @@ export class SessionRecording {
this._flushBuffer()
})

window?.addEventListener('offline', () => {
this._tryAddCustomEvent('browser offline', {})
})

window?.addEventListener('online', () => {
this._tryAddCustomEvent('browser online', {})
})

if (!this.instance.sessionManager) {
logger.error('Session recording started without valid sessionManager')
throw new Error('Session recording started without valid sessionManager. This is a bug.')
Expand Down

0 comments on commit fbe8ae5

Please sign in to comment.