Package Exports
- tiny-defer
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (tiny-defer) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
tiny-defer
Tiny Deferred for Client or Server
Example
var deferred = require('tiny-defer');
function something () {
var defer = deferred();
setTimeout(function () {
defer.resolve(true);
}, 1000);
return defer.promise;
}
something().then(function (arg) {
console.log(arg); // true;
});
API
promise
Promise
to pass/return
reject()
Rejects the Promise
resolve()
Resolves the Promise
How to use tiny-defer
tiny-defer
can be loaded as a CommonJS or AMD module, or with a script tag which would create window.deferred
.
License
Copyright (c) 2015 Jason Mulligan Licensed under the BSD-3 license