• Hi,

    I'm using espruino -d Bangle.js -w index.js to connect to my Bangle.js in watch mode. Everytime I change the file in my local IDE, it is re-uploaded and re-executed like expected.

    I've noticed that sometimes after I changed the file and it gets uploaded, the console shows

     ____                 _
    |  __|___ ___ ___ _ _|_|___ ___
    |  __|_ -| . |  _| | | |   | . |
    |____|___|  _|_| |___|_|_|_|___|
             |_| espruino.com
     2v17 (c) 2021 G.Williams
    
    >
    >Upload Complete
    

    while sometimes only

    >Upload Complete
    

    is shown, especially when I'm working on a larger file.

    In the latter case, however, the state on the watch is not reset correctly and event handlers are added up. For example, this code

    Bangle.on('touch', function (zone, e) {
      console.log(e);
    });
    console.log("Ready");
    

    makes the log message appear multiple times after multiple file uploads.

    When I long-press the button and then trigger a re-upload, the state is reset correctly.

    Is there anything I can do to re-initialize the event handlers before each re-upload in watch mode?

    Unfortunately, the small code example above does not reproduce the problem. It only happens with some larger code file.

    Kind regards,
    Johannes

About

Avatar for neshanjo @neshanjo started