27 ms·
I'll stick to Futures for; Futures work everywhere now and aren't immediately invoked when called with new.
by toastal 7y ago
I'll stick to Futures for; Futures work everywhere now and aren't immediately invoked when called with new.
- capableweb 7y agoNot sure exactly what futures you're referring to as there are no "native" futures in any browser (that I know of) so they are either implemented on top of Promises or by using callbacks, and still doesn't solve the problem of cancellation...
- toastal 7y agoYou're right. There's not a native solution. I've used Fluture (https://github.com/fluture-js/Fluture https://github.com/fluture-js/Fluture) for while now as it follows the Fantasy Land spec. The canceler is returned in the Future's constructor. The biggest feature difference in comparison to Promises is that you can pass around a Future adding to the data transformation without it being invoked until fork is called. It's good to know that there exists a way to do this natively now though.