Keep the green light on
This commit is contained in:
@@ -27,11 +27,9 @@ function resetCode() {
|
||||
function composeDigit(digit: number) {
|
||||
builder += digit.toString();
|
||||
display.innerText = builder + '_'.repeat(CODE.length - builder.length);
|
||||
light.classList.remove(IS_SUCCESS, IS_ERROR);
|
||||
if (CODE.startsWith(builder)) {
|
||||
light.classList.add(IS_SUCCESS);
|
||||
if (builder !== CODE) {
|
||||
setTimeout(() => light.classList.remove(IS_SUCCESS), DELAY);
|
||||
}
|
||||
} else {
|
||||
light.classList.add(IS_ERROR);
|
||||
setTimeout(resetCode, DELAY);
|
||||
|
Reference in New Issue
Block a user