Closed manyuemeiquqi closed 8 months ago
When i view this line finally, i confused this case
new Promise((resolve, reject) => { resolve("1"); }) .finally(2) .then((res) => { console.log("res: ", res); });
onFinally
Should replace
return promiseResolve(C, onFinally()).then(function () { return x; }); } : onFinally, with
return promiseResolve(C, onFinally()).then(function () { return x; }); } : onFinally,
return this.then( isFunction ? function (x) { return promiseResolve(C, onFinally()).then(function () { return x; }); } : x,
Everything works fine. See the spec:
The answer to the question "why?" is a little below in the spec:
When i view this line finally, i confused this case
finally should return value or reason whether the
onFinally
is a function or notShould replace
return promiseResolve(C, onFinally()).then(function () { return x; }); } : onFinally,
withreturn this.then( isFunction ? function (x) { return promiseResolve(C, onFinally()).then(function () { return x; }); } : x,