Meteor Fibers and Dynamics

Meteor._wrapAsync

Meteor._wrapAsync allows us to wrap an asynchronous function so we can call it in a synchronous style. It does this without sacrificing the performance benefits of IO related asynchronous functions by using Fibers and Meteor.bindEnvironment. In this video I'll review what it means to be asynchronous by diagraming the event loop. Then we'll use Meteor._wrapAsync to wrap an asynchronous function. Finally, I give some examples of where Meteor._wrapAsync is used in Core, and how you can use it with third party libraries.