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

异步编程引发的callback hell 问题采用Promise / A编程模式解决更合理 #2

Open
hh54188 opened this issue Aug 23, 2014 · 1 comment

Comments

@hh54188
Copy link

hh54188 commented Aug 23, 2014

No description provided.

@zhangziqiu
Copy link
Owner

值得探索. 我认为promise和event事件机制不再一个层次上. promise是接口层面的, 而event是更底层的支持.

  1. promise模式导致内部流程控制变得复杂, 内部代码不宜维护
  2. promise是一个很重的模式, 缺乏灵活性. 在一些场景下会导致较严重的代码污染. 即会将逻辑代码和为了实现promise模式的代码混在在一起.
  3. 实现promise模式, 可以使用event类提供的事件机制. 避免闭包, 这块后续可以探索看看.

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

2 participants