($modal, pad)
| 54 | }; |
| 55 | |
| 56 | const createTimerForModal = ($modal, pad) => { |
| 57 | const timeUntilReconnection = |
| 58 | clientVars.automaticReconnectionTimeout * reconnectionTries.nextTry(); |
| 59 | const timer = new CountDownTimer(timeUntilReconnection); |
| 60 | |
| 61 | timer.onTick((minutes, seconds) => { |
| 62 | updateCountDownTimerMessage($modal, minutes, seconds); |
| 63 | }).onExpire(() => { |
| 64 | const wasANetworkError = $modal.is('.disconnected'); |
| 65 | if (wasANetworkError) { |
| 66 | // cannot simply reconnect, client is having issues to establish connection to server |
| 67 | waitUntilClientCanConnectToServerAndThen(() => { forceReconnection($modal); }, pad); |
| 68 | } else { |
| 69 | forceReconnection($modal); |
| 70 | } |
| 71 | }).start(); |
| 72 | |
| 73 | return timer; |
| 74 | }; |
| 75 | |
| 76 | const disableAutomaticReconnection = ($modal) => { |
| 77 | toggleAutomaticReconnectionOption($modal, true); |
no test coverage detected