Sunday, 15 May 2011

how to return value from this scope (Node.js) -



how to return value from this scope (Node.js) -

i have node.js module homecoming memory used:

//meminfo.js module.exports = myobj; myobj = (function() { var pub = {}; pub.getmem = function() { meminfo.list(function(memused) { homecoming memused; }); }; homecoming pub; })();

if want retrieve memused this:

//main.js var meminfo = require('./meminfo'); console.log(myobj.getmem());

then give me suggestions how homecoming 'memused' in meminfo.js:

meminfo.list(function(memused) { homecoming memused; });

node.js

No comments:

Post a Comment