Skip to content

Commit

Permalink
fix(onlineManager): listen to 'offline' events (#1656)
Browse files Browse the repository at this point in the history
Fixes #1654
  • Loading branch information
kripod committed Jan 15, 2021
1 parent 2de2a0d commit e9208b2
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/core/onlineManager.ts
Expand Up @@ -53,10 +53,12 @@ class OnlineManager extends Subscribable {
this.setEventListener(onOnline => {
// Listen to online
window.addEventListener('online', onOnline, false)
window.addEventListener('offline', onOnline, false)

return () => {
// Be sure to unsubscribe if a new handler is set
window.removeEventListener('online', onOnline)
window.removeEventListener('offline', onOnline)
}
})
}
Expand Down

1 comment on commit e9208b2

@vercel
Copy link

@vercel vercel bot commented on e9208b2 Jan 15, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.