javascript - how does meteor handle async calls -


starting working on new meteor app, have done node.js projects callbacks or promises handle async code going through meteor tutorials; async methods have no callbacks or promises. how handled? example code tutorial:

var party = parties.findone(partyid); if (!party)   throw new meteor.error(404, "no such party"); if (party.owner !== this.userid)   throw new meteor.error(404, "no such party"); if (party.public)   throw new meteor.error(400,     "that party public. no need invite people."); 

how can fetch db , perform operations on party

meteor uses magical abstraction coroutines called fiber. works same async/await in many other languages. desribe possible: there callbacks underneath, don't need handle them hand.

https://github.com/laverdet/node-fibers

/edit
there great article on meteorhacks describing how fibers work: https://meteorhacks.com/fibers-eventloop-and-meteor


Comments

Popular posts from this blog

java - UnknownEntityTypeException: Unable to locate persister (Hibernate 5.0) -

python - ValueError: empty vocabulary; perhaps the documents only contain stop words -

ubuntu - collect2: fatal error: ld terminated with signal 9 [Killed] -