Meteor.wrapAsync

Anywhere

Meteor.wrapAsync(func, [context])

import { Meteor } from 'meteor/meteor' Source

Wrap a function that takes a callback function as its final parameter. The signature of the callback of the wrapped function should be function(error, result){}. On the server, the wrapped function can be used either synchronously (without passing a callback) or asynchronously (when a callback is passed). On the client, a callback is always required; errors will be logged if there is no callback. If a callback is provided, the environment captured when the original function was called will be restored in the callback.

Arguments

func Function

A function that takes a callback as its final parameter

context Object

Optional this object against which the original function will be invoked

doc_Meteor
2016-05-29 17:21:08
Comments
Leave a Comment

Please login to continue.