erikras / erikras/react-redux-universal-hot-example
How to cansel Promise in `_ApiClient.js`
- Dominant language
- JavaScript
- Stars
- 12.1k
- Forks
- 2.5k
- PR merge metrics
- No merged PRs in 30d
Description
Im Want When Route Changed, If any request is pending and Related to that component is destroying cansel it...
example of cansel a promise :
```
//this promise has a way to stop what it is doing
var p1 = new Promise(function(resolve, reject, ignored){
var task = setTimeout(resolve.bind(null, "the result"), 1000);
ignored(() => clearTimeout(task));
});
//ignore the result from the above promise, triggers the ignored listener
p1.ignore();
p1.then(result => "this is never called");
//this promise cannot be cancelled, but the result can be ignored
var p2 = Promise.resolve("the result");
//the callback is not called until next event loop cycle
p2.then(result => "this is never called");
//the result is ignored, the above callback is never run
p2.ignore();
```
Im want somthing like this for all components and request.
Contributor guide
Assessment
This issue has not been assessed yet.