Added: Timeout ms

This commit is contained in:
Luc Mcgrady 2025-10-03 23:53:38 +01:00
parent fcd2c67262
commit b6ce0c6ae0
No known key found for this signature in database
GPG key ID: 4F3D7A0B17CC3D9C

View file

@ -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_CLICK_TIMEOUT_MS = 500;
let clickCount = 0;
let clickTimeout: ReturnType<typeof setTimeout>;
function onClick() {
clickCount += 1;
clearTimeout(clickTimeout);
if (clickCount < UNLOCK_EDIT_COUNT) {
clickTimeout = setTimeout(() => {
clickCount = 0;
}, UNLOCK_CLICK_TIMEOUT_MS);
}
}
$: unlockEditWarning =