Hacker News new | ask | show | jobs
by eloox 1463 days ago
setTimeout doesn't guarantee that it will execute exactly after 3000.

  (() => {
    const targ = $(".setGo");
    const targ2 = $(".theSport > div:nth-child(2)");
    const observer = new MutationObserver((mutations, observer) => {
      if (mutations[0]?.target?.classList.contains('going')) {
        targ2.childNodes.forEach(c => c.click());
      }
    });
  
    observer.observe(targ, {
      subtree: false,
      attributes: true
    });
  
    $('.readyButton').click()
  })();
  
This gives me consistent Time: 0.001 in FF. "Time: not yet set" in Edge/Chrome.
1 comments

Today I learned. Thank you!