• I tried to follow the Example , but in Espruino IDE it didn't really work.

    I tried the following:

    module moq_base.js

    var wifi = require( "Wifi" );
    function MoqBase(){};
    MoqBase.prototype.ssid;
    MoqBase.prototype.startPairing = function () {...}
    

    and then "inherit":

    var MoqBase = require( "moq_base" );
    Moq.prototype = new MoqBase();
    Moq.prototype.constructor = Moq; 
    function Moq( options ) {....}
    

    but it resulted in exceptions like

    Uncaught Error: Constructor should be a function, but is Object
    at line 5 col 21
    Moq.prototype = new MoqBase();

    I tried also to define a plain function inside the "base" module and then call it, but it also fails - function not found.

    So, are there any examples / tutorials on using JS-inheritance / inlcusion for ESP?
    Or, it shouldn't be used and copy & paste is my only true friend?

    Thanks!

About

Avatar for Injecteer @Injecteer started