toloframework
Version:
Javascript/HTML/CSS compiler for Firefox OS or nodewebkit apps using modules in the nodejs style.
23 lines (17 loc) • 561 B
JavaScript
;
exports.generateCodeFrom = function ( def, codeBehind, moduleName ) {
const global = {};
for ( const attName in def ) {
if ( attName === '0' ) continue;
const attValue = def[ attName ];
global[ attName ] = parseAttributeValue( attValue );
}
return `${codeBehind}
//--------------------------
// Module global variables.
` + Object.keys( global )
.map( key => `GLOBAL[${JSON.stringify(key)}] = ${JSON.stringify(global[key])};\n` );
};
function parseAttributeValue( value ) {
return value;
}