I use the .then
and _.bind
in the series. I want to stop the execution of a function (ie) the output of the previous function will be introduced for the next function. Here is my code.
return getProducts(barcode, sku) .then(_.bind(this.checkForPrice, this)) .then(_.bind(this.addLinkedProducts, this)) .then(null, _.bind(this.handleUnknownError, this));
In the checkForPrice
function, I use return false to stop execution, as shown below, but this did not stop the thread.
checkForPrice: function (products) { debugger; if (!products) { return false; } return something; }
Please help solve this problem.
source share