mirror of
https://github.com/overleaf/overleaf.git
synced 2025-01-30 22:04:09 +00:00
use browser 'online' event to trigger reconnect
This commit is contained in:
parent
87d8192d29
commit
2a8efea29a
1 changed files with 6 additions and 0 deletions
|
@ -20,6 +20,12 @@ define [], () ->
|
|||
@disconnectIfInactive()
|
||||
, ONEHOUR)
|
||||
|
||||
# trigger a reconnect immediately if network comes back online
|
||||
window.addEventListener 'online', =>
|
||||
sl_console.log "[online] browser notified online"
|
||||
if !@connected
|
||||
@tryReconnectWithRateLimit({force:true})
|
||||
|
||||
@userIsLeavingPage = false
|
||||
window.addEventListener 'beforeunload', =>
|
||||
@userIsLeavingPage = true
|
||||
|
|
Loading…
Reference in a new issue