• Hi,

    Reading your question more carefully, your problem is the value of this in the setInterval, probably the global context which is not what you want.
    This can be resolved by sending the right context object for this as an added last argument in setInterval or seTimeout as below.

    ...
    var timeoutID = setTimeout(function (self) {
      console.log(self); 
    }, 500, this);
    ...
    

    So, your object, instance of class, will be called self in the setInterval/SetTimeout at execution time...

    You should look at the reference of setInterval and this non Espruino thread or this other one

  • I disagree with you

    1. This code works without modification under NodeJS;
    2. This code works if it is issued in the prototype style of ES5.

    It seems to me that the problem is in Espruino

About

Avatar for Konkery @Konkery started