Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

关于then的链式操作 #13

Open
samcin opened this issue Sep 12, 2023 · 0 comments
Open

关于then的链式操作 #13

samcin opened this issue Sep 12, 2023 · 0 comments

Comments

@samcin
Copy link

samcin commented Sep 12, 2023

但是,如果前面步骤返回值是一个Promise的话,情况就不一样了 ———— 如果前面返回的是Promise对象,后面的then将会被当做这个返回的Promise的第一个then来对待。
这句话描述是有问题的,对于任何then语句后面的返回值,如果是非Promise,则会包装成一个Fullfiled的 Promise实例返回,这自然会触发下一个then的执行;如果返回的是Promise实例,就不一定了,是由Promise本身的状态决定的:pending、fullfiled或reject,这三个状态引发的动作是不一样的。
大家可以做一做实验。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant