You are reading a single comment by @Tx and its replies. Click here to read the full conversation.
  • I think that's pretty broken too... If you run it twice you get two timeouts. Can you try adding some prints to the original code to see what's going on?

    We use that pattern (if (x) clearTimeout(x);x = setTimeout(function() { x=undefined; ... },...)) all over the place so I don't think there's anything specifically wrong with it.

    function planChime() {
      if (chimeTimer) {
        clearTimeout(chimeTimer);
      }
      chimeTimer = setTimeout(function() {
        chimeTimer = undefined;
        Bangle.buzz().then(() => {
          setTimeout(function(){
             planChime();
          }, 2000);
          });
      }, 3600000 - (Date.now() % 3600000));
    }
    
  • I'm still struggeling on this.
    Edit: Post deleted - I had another idea, still testing ..

About

Avatar for Tx @Tx started