Developing a CLI application becomes quite simple with a blocking I/O API like PrintLn / ReadLn, making the process smooth and efficient.
However, the challenge arises when trying to create a terminal application that runs on a browser using JS. In this scenario, input events are asynchronous, which means you cannot block the function midway through while waiting for input without disrupting the application's state.
I am currently grappling with designing the event loop and structuring the architecture of the JavaScript code. This is especially tricky as there will be multiple levels of commands within the app, and I want to avoid falling into the trap of "callback hell". Could someone please guide me to a resource or provide tips on how to architect this design? Thank you.