You are reading a single comment by @JumJum and its replies. Click here to read the full conversation.
  • Prototyping works fine in Espruino like this:

    function a(v){ this.a = v; = function() {this.a++;}; }
    function b(v,x){,v); this.b = x; }
    b.prototype = a;
    b.prototype.constructor = b;
    var t = new b(1,5); console.log(t.a,t.b);; console.log(t.a,t.b);

    I now would like to create something like OneWireDS18_20 using prototype and cannot get it working.

    function myOneWire(pin){,pin); }
    myOneWire.prototype = OneWire;
    myOneWire.prototype.constructor = myOneWire;
    var myOW = new myOneWire(D8);


Avatar for JumJum @JumJum started