diff options
author | Michael Meeks <michael.meeks@collabora.com> | 2019-12-14 17:26:01 +0000 |
---|---|---|
committer | Michael Meeks <michael.meeks@collabora.com> | 2019-12-14 17:26:01 +0000 |
commit | 3a0172f5f9687200ad261bf62f11defaa875d5e7 (patch) | |
tree | 73453a936cf3640a528cef057e8c095b69acec7f | |
parent | 5d5fb42715e2ebff3639c801016fdcac26ed2420 (diff) |
re-connect after idle timeout properly.
Another horror caused by some unexpected vex change, now we listen
for afterClose to be sure that when the dialog is gone we started to
try to re-connect.
Change-Id: Ic053df665d188f25f6ddf3b081433bbd6dd37820
-rw-r--r-- | loleaflet/src/core/Socket.js | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/loleaflet/src/core/Socket.js b/loleaflet/src/core/Socket.js index 706234980..653b71366 100644 --- a/loleaflet/src/core/Socket.js +++ b/loleaflet/src/core/Socket.js @@ -453,18 +453,30 @@ L.Socket = L.Class.extend({ message = msg; } - var dialogOpened = vex.dialog.open({ + var dialogOptions = { message: message, contentClassName: 'loleaflet-user-idle' - }); + }; + var restartConnectionFn; if (textMsg === 'idle' || textMsg === 'oom') { var map = this._map; - dialogOpened.contentEl.onclick = function() { - console.debug('idleness: reactivating'); - map._documentIdle = false; - return map._activate(); + restartConnectionFn = function() { + if (map._documentIdle) + { + console.debug('idleness: reactivating'); + map._documentIdle = false; + return map._activate(); + } + return false; }; + dialogOptions.afterClose = restartConnectionFn; + } + + var dialogOpened = vex.dialog.open(dialogOptions); + + if (textMsg === 'idle' || textMsg === 'oom') { + dialogOpened.contentEl.onclick = restartConnectionFn; $('.vex-overlay').addClass('loleaflet-user-idle-overlay'); } |