O'Reilly logo

Meteor Cookbook by Isaac Strack

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Handling asynchronous events

Meteor is a reactive framework. As you've probably noticed, it's built on top of Node.js, but when writing or using packages, it somehow magically avoids all of the callback and event loop drama you'd normally face with Node.js. Meteor lets you code in a declarative, synchronous-like style. This recipe will show you one of the ways Meteor does this, and how you can handle asynchronous events coming in from a third-party package. In this case, we will read an incoming Twitter stream from the npm twit package.

Getting ready

We need to quickly set up a test application on Twitter and load the npm twit module, so we'll do that here, so as not to distract from the recipe itself. Note that you can use any asynchronous event ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required