mirror of
https://github.com/ankitects/anki.git
synced 2025-11-06 20:57:13 -05:00
Added: Timeout ms
This commit is contained in:
parent
fcd2c67262
commit
b6ce0c6ae0
1 changed files with 10 additions and 0 deletions
|
|
@ -48,9 +48,19 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
}
|
}
|
||||||
|
|
||||||
const UNLOCK_EDIT_COUNT = 3;
|
const UNLOCK_EDIT_COUNT = 3;
|
||||||
|
const UNLOCK_CLICK_TIMEOUT_MS = 500;
|
||||||
let clickCount = 0;
|
let clickCount = 0;
|
||||||
|
|
||||||
|
let clickTimeout: ReturnType<typeof setTimeout>;
|
||||||
|
|
||||||
function onClick() {
|
function onClick() {
|
||||||
clickCount += 1;
|
clickCount += 1;
|
||||||
|
clearTimeout(clickTimeout);
|
||||||
|
if (clickCount < UNLOCK_EDIT_COUNT) {
|
||||||
|
clickTimeout = setTimeout(() => {
|
||||||
|
clickCount = 0;
|
||||||
|
}, UNLOCK_CLICK_TIMEOUT_MS);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$: unlockEditWarning =
|
$: unlockEditWarning =
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue