0.0.3 • Published 8 years ago
fresh-promise v0.0.3
fresh-promsie
promise that keeps itself fresh
var FreshPromise = require("fresh-promise");
var cached = new FreshPromise(5000/*ttl*/, function() {
return Promise.resolve(Math.random());
});
cached.then(...);
cached.then(...); // should be the same
sleep(5000).then(...); // promise should be updated