Isn't it possible to cancel an ES6 Promise by just calling Promise.reject(reason)
?
Something like this:
Promise.resolve().then(function () {
return 'foo';
}).then(function () {
return console.log('we were here');
}).then(function () {
return Promise.reject({type: 'canceled'})
}).then(function () {
return console.log('never visited');
}).catch(function (e) {
console.log(e);
});
is there any downside to "cancelling" promises via Promise.reject
?