https://github.com/zweifisch/fresh-promise
promise that keeps itself fresh
https://github.com/zweifisch/fresh-promise
Last synced: about 2 months ago
JSON representation
promise that keeps itself fresh
- Host: GitHub
- URL: https://github.com/zweifisch/fresh-promise
- Owner: zweifisch
- Created: 2015-08-10T01:54:04.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2016-03-20T03:38:11.000Z (about 9 years ago)
- Last Synced: 2025-01-27T22:55:07.882Z (4 months ago)
- Language: CoffeeScript
- Size: 2.93 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# fresh-promsie
[![NPM Version][npm-image]][npm-url]
[![Build Status][travis-image]][travis-url]promise that keeps itself fresh
```js
var FreshPromise = require("fresh-promise");var cached = new FreshPromise(5000/*ttl*/, function() {
return Promise.resolve(Math.random());
});cached.then(...);
cached.then(...); // should be the samesleep(5000).then(...); // promise should be updated
```[npm-image]: https://img.shields.io/npm/v/fresh-promise.svg?style=flat
[npm-url]: https://npmjs.org/package/fresh-promise
[travis-image]: https://img.shields.io/travis/zweifisch/fresh-promise.svg?style=flat
[travis-url]: https://travis-ci.org/zweifisch/fresh-promise