cancelable promises ?
I remember seeing this (at the bottom of the page) https://reactjs.org/blog/2015/12/16/ismounted-antipattern.html
const cancellable = fn => { let cancelled = false; return [ (...args) => cancelled || fn(...args) () => cancelled = true ]; }; const [ wrapped, cancel ] = cancellable(myFn); p.then(wrapped) // call cancel to cancel
Bluebird
Why do you need cancellable promises? You probably don't
He clearly says he wants a cancellable promise here.
https://gist.github.com/getify/1173cac45d15fc4ff0a880f32fd598ab
Обсуждают сегодня