Package Exports
- lie
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 (lie) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
lie

lie is a JavaScript promise/deferred implementation, implementing the Promises/A+ spec.
A fork of Ruben Verborgh's library called promiscuous. Which takes advantage of setImmediate if available, uses object cunstructors, and that I can actually consistently spell.
To use grab a copy from the dist folder, we offer both production (minfied) and development (readable) builds as well as a version that bundles a very good setImmediate shim in with it (set Immediate === much much faster promises).
API
by defailt adds 3 function to the global scope
return a promise
function waitAwhile
var def = deferred();
setTimeout(function(){
def.resolve('DONE!');
},10000);//resolve it in 10 secons
return def.promise//return the promise
}
Create a resolved promise
var one = resolve("one");
one.then(console.log);
/* one */
Create a rejected promise
var none = reject("error");
none.then(console.log, console.error);
/* error */
Write a function turns node style callback to promises
function denodify(func) {
return function(){
var args = Array.prototype.concat.apply([],arguments);
var def = deferred();
args.push(function(err,success){
if(err) {
def.reject(err);
} else {
def.resolve(success);
}
});
function.apply(undefined,args);
return def.promise;
}
}
##node
install with npm install lie
, exactly the same as above but
var lie = require('lie');
var deferred = lie.deferred;
var resolve = lie.resolve;
var reject = lie.reject;
Or you could just use the lie prefix.