Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

120
Views
Is there a way to do or simulate busy/wait style input in browser javascript?

I want to convert some command line style programs into JavaScript for use in a browser. I'm planning on using xterm.js to orchestrate the terminal aspect of the project, but I'm at a loss for how to convert these to the asynchronous nature of JavaScript in the browser. These programs use busy/wait style input.. like this:

print ("what is your name")
name = input() // waits until user enters data
print ("hello ", name)
print ("how old are you")
age = input()  // waits until user enters data
...

I know I can redesign the whole program to be asynchronous, but I want to avoid that since it would be a pretty substantial amount of work. Is anyone aware of any techniques that can achieve this without a huge redesign?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

If you want to imitate a console, you can look at example on main page of Xterm.js website (source code).

You need to handle onData() event.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!