Echo JS 0.11.0

<~>
MaxArt 3682 days ago. link parent 1 point ▲ ▼
Would be nice to have a `wake` function that cancels the timeout, rejecting the promise. Something like Angular's $timeout.
But I guess you need at least a bunch of lines for that.

Replies

xab 3681 days ago. link 1 point ▲ ▼
Cancellable promises would be nice, to be exact. It's not the timeout that hurts for me, but the fetch.
MaxArt 3681 days ago. link 1 point ▲ ▼
Indeed, it's one of the main arguments about the future development of JS promises.

Also, `setTimeout` should be updated to become a promise (alas, won't happen because `setInterval` can't be promisified too).
xat 3681 days ago. link 3 points ▲ ▼
Maybe Promises are just the wrong tool for this kind of stuff in general. 

Interestingly it would be no problem solving these problems with Observables. Cancelation can be done with `dispose` and  setInterval would also be trivial to implement.
xat 3682 days ago. link 1 point ▲ ▼
I agree on that. In about 30% of the cases, that I use setTimeout, there is some cancelation logic involved (polling, debounce etc.).