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

126
Views
How to detect a keypress event inside a function? Nodejs

How can a keypress be detected only inside a function and not on all code? I have this code:

async function sellFunction() {

    let i = 0;
    let handle = setInterval(function() {
        logUpdate("Hello" + i++)
    }, 100);
    gkm.events.on('key.*', async(data) => {
        if (gkm.events.event === 'key.released' && (data[0] == 'A' || data[0] == 'B' || data[0] == 'C' || data[0] == 'D' || data[0] == 'F')) {
            clearInterval(handle);
            gkm.events.removeAllListeners();
            await init();
        }
    });

}

The problem with this is that this key event is being detected even if im in another function.

about 4 years ago · Juan Pablo Isaza
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!