mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-06-11 07:00:47 +02:00
use browser 'online' event to trigger reconnect
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user