loopbackjs - In loopback documentation what does variable 'cb' stands for? -
look @ loopback code in documentation http://docs.strongloop.com/display/public/lb/defining+and+using+roles, trying understand since start 'cb'. understand kind of callback why round place? have async.js??
it has way node works asynchronously. uses 'event loop' passes off other i/o functions background worker thread. when background work completes event loop receives callback. there's discussion of here: why node.js asynchronous?
node libraries call on expensive resources follow model gain performance.
the callback function pass library function executed when function completes processing. it's anonymous.
the convention have function accept error parameter first argument , results subsequent ones. you'll see pattern everywhere:
lib.somfunc( 'argument', function(err, res){ if(err).... });
async.js bit different. it's library provides various means orchestrating asynchronous code uses callbacks.
Comments
Post a Comment