lib/boilerplate.view.js
function outputAll( code, moduleName ) {
    try {
        let out = outputComments( code );
        out += "  module.exports = function() {\n";
        out += outputNeededConstants( code );
        out += `    //-------------------
    // Class definition.
    const ViewClass = function( args ) {
      try {
        if( typeof args === 'undefined' ) args = {};
        this.$elements = {};
        ${outputClassBody(code)}
      }
      catch( ex ) {
        console.error('${moduleName}', ex);
        throw Error('Instantiation error in XJS of ${JSON.stringify(moduleName)}:\\n' + ex)
      }
    };\n`;
        out += generate( code.section.statics, "Static members.", "    " );
        out += "    return ViewClass;\n";
        out += "  }();\n";
        return out;
    } catch ( ex ) {
        bubble( ex, "outputAll()" );
        return null;
    }
}
function outputAll( code, moduleName ) {
    try {
        let out = outputComments( code );
        out += "  module.exports = function() {\n";
        out += outputNeededConstants( code );
        out += `    //-------------------
    // Class definition.
    const ViewClass = function( args ) {
      try {
        if( typeof args === 'undefined' ) args = {};
        this.$elements = {};
        ${outputClassBody(code)}
      }
      catch( ex ) {
        console.error('${moduleName}', ex);
        throw Error('Instantiation error in XJS of ${JSON.stringify(moduleName)}:\\n' + ex)
      }
    };\n`;
        out += generate( code.section.statics, "Static members.", "    " );
        out += "    return ViewClass;\n";
        out += "  }();\n";
        return out;
    } catch ( ex ) {
        bubble( ex, "outputAll()" );
        return null;
    }
}
function outputAll ( code , moduleName ) { try { let out = outputComments ( code ) ; out += "  module.exports = function() {\n" ; out += outputNeededConstants ( code ) ; out += ` ${ outputClassBody ( code ) } ${ moduleName } ${ JSON . stringify ( moduleName ) } \\ \n ` ; out += generate ( code . section . statics , "Static members." , "    " ) ; out += "    return ViewClass;\n" ; out += "  }();\n" ; return out ; } catch ( ex ) { bubble ( ex , "outputAll()" ) ; return null ; } }
Generate the JS code for the XJS module.

@param  {object} code - Helper for Javascript code writing.
@param {string} moduleName - Javascript module name.

@return {string} Resulting JS code.
Generate the JS code for the XJS module .