Module: Defer

Defer is a factory that would create a wrapped Promise object with exposed resolve / reject API so that we can easily resolve / reject promise from outside.

This is mostly useful when you are going to queue promises for later use.


var defer = Defer(); defer.resolve('return value'); defer.reject('reason')