Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Asynchronous done right with Meteor

Asynchronous done right with Meteor

my talk at the #4th meteorjs paris meetup presenting how and why meteorjs switched to fibers to better deal with asynchronous code and void the callback pyramid of doom.

Abderrazak BOUADMA

December 19, 2013
Tweet

Other Decks in Programming

Transcript

  1. #4

  2. Meteor is a platform built on top of NodeJS to

    build cutting edge fast web applications.
  3. created to Get Things Done locked free approach scalable to

    the infinity … and beyond Embraces Simplicity
  4. created to Get Things Done locked free approach scalable to

    the infinity … and beyond Embraces Simplicity
  5. created to Get Things Done locked free approach scalable to

    the infinity … and beyond Embraces Simplicity
  6. created to Get Things Done locked free approach scalable to

    the infinity … and beyond Embraces Simplicity
  7. Event Loop is a programming construct that waits for and

    dispatches events or messages in a program
  8. var fs = require('fs'); fs.readFile( __dirname + '/test.txt', function (err,

    data) { if (err) { throw err; } console.log(data.toString()); });
  9. var fs = require('fs'); fs.readFile( __dirname + '/test.txt', function (err,

    data) { if (err) { throw err; } }); console.log(data.toString());
  10. var fs = require('fs'); fs.readFile( __dirname + '/test.txt', function (err,

    data) { if (err) { throw err; } }); // console.log(data.toString()); won’t run as the ‘data’ // variable is not accessible at this point.
  11. Solution var fs = require('fs'); var d; fs.readFile( __dirname +

    '/test.txt', function (err, data) { if (err) { throw err; } d = data; }); console.log(d.toString());