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

1.2在这种情况下 catch 的回调函数并不会被执行(因为promise返回了resolve), 不过如果运行环境没有提供 setTimeout 函数的话,那么上面代码在执行中就会产生异常,在 catch 中设置的回调函数就会被执行。 #38

Open
ghost opened this issue Mar 22, 2017 · 1 comment

Comments

@ghost
Copy link

ghost commented Mar 22, 2017

URL : http://liubin.org/promises-book/#promises-overview

setTimeout(function () {
resolve('Async Hello world');
}, 16);

在1.2中有句话产生歧义,“在这种情况下 catch 的回调函数并不会被执行(因为promise返回了resolve), 不过如果运行环境没有提供 setTimeout 函数的话,那么上面代码在执行中就会产生异常,在 catch 中设置的回调函数就会被执行。” 文中“没有提供 setTimeout ”对于一般阅读的人的感觉就是取消掉代码块中的setTimeout这个函数。哈_哈 强迫症你懂的

@tamamadesu
Copy link

但是,就算整个把setTiemout 内部 都删除,也不会执行catch啊

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