Closed LandonSchropp closed 3 years ago
I testet it and it seems to work better than ever. The code is now cleaner and better understandable and better useable. Thanks for your great work, I will merge it now. I also think about removing the debounce when resizing, because it makes a better UI feeling if the board directly responds to resizing. Thanks again.
Thank you!
This PR turned out to be a bit bigger than we discussed, but I think the additional work was helpful.
Once I removed the debounce functions, it turns out that the
initialization
function was no longer needed because none of the code that was being initialized was asynchronous. I was also running into an issue withsetOrientation
once I madeChessboardView#redraw
synchronous, and removing theinitialization
promise fixed it. This in turn meant that many of the functions that relied oninitialization
could also be made synchronous.The end result of this is the only asynchronous function in
Chessboard.js
issetPosition
. I had to refactor the promise logic a little in this function onceinitialization
was removed, but I think the changes simplify things.I'm especially pleased with how the
redraw
function turned out after the refactor:Finally, I split the changes up into several commits. This should make reviewing the changes much easier, as you can see what happened at each one.
Please let me know if there's anything else you'd like to see here. Thanks!