For your own sanity, please use a formatter for your IDE. This will also help when others (and you) read the code, as indentation is a convenience for understanding program flow. From what I see:
- Your
enable
anddisable
functions are never called for this portion of code - You use a possibly undeclared
enabled
variable, if so it never passes scopes between thehandleClick
andanimation
methods - You do not use any callback or
await
forinvoke
orupdateCurrentBox
, causing all the code after either to immediately run. As a result,enabled
is neverfalse
, since it just instantly flips back totrue
. I'm not sure what libraryinvoke
is from, but there should be a callback or the function returns aPromise
which can beawait
ed.