fresh-promise

0.0.3 • Public • Published

fresh-promsie

NPM Version Build Status

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

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 0.0.3
    2
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 0.0.3
    2
  • 0.0.2
    1
  • 0.0.1
    1

Package Sidebar

Install

npm i fresh-promise

Weekly Downloads

4

Version

0.0.3

License

MIT

Last publish

Collaborators

  • zf