mirror of
https://github.com/screentinker/screentinker.git
synced 2026-05-15 07:32:23 -06:00
Fix possible race condition in player auto-connect
This commit is contained in:
parent
98e742c612
commit
f6ef75549b
|
|
@ -366,7 +366,13 @@
|
||||||
// ==================== Boot ====================
|
// ==================== Boot ====================
|
||||||
|
|
||||||
// Function used by connect button and auto-connect
|
// Function used by connect button and auto-connect
|
||||||
|
let autoContinueTimer;
|
||||||
function connectBtnFunc() {
|
function connectBtnFunc() {
|
||||||
|
if (autoContinueTimer) {
|
||||||
|
clearInterval(autoContinueTimer);
|
||||||
|
autoContinueTimer = null;
|
||||||
|
document.getElementById('connectBtn').textContent = _t('connect');
|
||||||
|
}
|
||||||
unlockAudio();
|
unlockAudio();
|
||||||
const url = document.getElementById('serverUrl').value.trim().replace(/\/$/, '');
|
const url = document.getElementById('serverUrl').value.trim().replace(/\/$/, '');
|
||||||
if (!url) return;
|
if (!url) return;
|
||||||
|
|
@ -433,7 +439,7 @@
|
||||||
|
|
||||||
connectBtn.textContent = `${_t('connect')} (${countdown})`;
|
connectBtn.textContent = `${_t('connect')} (${countdown})`;
|
||||||
|
|
||||||
const autoContinueTimer = setInterval(() => {
|
autoContinueTimer = setInterval(() => {
|
||||||
countdown--;
|
countdown--;
|
||||||
if (countdown > 0) {
|
if (countdown > 0) {
|
||||||
connectBtn.textContent = `${_t('connect')} (${countdown})`;
|
connectBtn.textContent = `${_t('connect')} (${countdown})`;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue