Both of your examples should behave pretty much the same.A value returned inside athen()
handler becomes the resolution value of the promise returned from thatthen()
. If the value returned inside the.then
is a promise, the promise returned bythen()
will "adopt the state" of that promise and resolve/reject just as the returned promise does.In your first example, you return"bbb"
in the firstthen()
handler, so"bbb"
is passed into the nextthen()
handler.In your second example, you return a promise that is immediately resolved with the value"bbb"
, so"bbb"
is passed into the nextthen()
handler. (ThePromise.resolve()
here is extraneous).The outcome is the same.If you can show us an example that actually exhibits different behavior, we can tell you why that is happening.
Tuesday 29 October 2019
Vuex resolve
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment