https://github.com/nitzantomer/future.js
A different way to use promises
https://github.com/nitzantomer/future.js
Last synced: about 1 month ago
JSON representation
A different way to use promises
- Host: GitHub
- URL: https://github.com/nitzantomer/future.js
- Owner: nitzantomer
- License: mit
- Created: 2016-09-10T18:16:35.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2016-09-11T21:53:18.000Z (almost 10 years ago)
- Last Synced: 2025-02-15T07:07:33.358Z (over 1 year ago)
- Language: TypeScript
- Homepage:
- Size: 6.84 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# future.js
A simple wrapper for the promise object which can be used when the logic of the async operation should not be implemented
inside the promise.
A simple example:
```typescript
class MyRemoteDataFetcher {
fetch(): Promise {
let future = new Future();
// make a remote request, when it returns:
future.resolve(VALUE_FROM_REMOTE);
// or if it fails:
future.reject(MESSAGE);
return future.asPromise();
}
}
```