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

249
Views
Javascript - async addEventListener

I'm trying to learn/code async Javascript (Chrome extension) and I'm getting two errors. Can someone please assist?

self.addEventListener('wheel', (e) => {
    e.waitUntil(async function () { // Error: Uncaught TypeError: e.waitUntil is not a function
        
        if (e.deltaX == 0 && e.deltaZ == 0) {
            if (e.deltaY > 0)  triggerKeydown(false);
            else if (e.deltaY < 0)  triggerKeydown(true);
        }
        await delay(1000);
        window.scrollTo(0, 0);
        
        return; 
    });
});

const delay = ms => new Promise(res => setTimeout(res, ms));

2nd Error (it didn't supply a line number):

The service worker navigation preload request was cancelled before 'preloadResponse' settled. If you intend to use 'preloadResponse', use waitUntil() or respondWith() to wait for the promise to settle.

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

0

Thanks for the help @epascarello. It now works by adding: async (e) => {

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!