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

docs: remove async-function #1713

Merged
merged 5 commits into from
Nov 29, 2017
Merged

docs: remove async-function #1713

merged 5 commits into from
Nov 29, 2017

Conversation

atian25
Copy link
Member

@atian25 atian25 commented Nov 24, 2017

Checklist
  • npm test passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines
Affected core subsystem(s)
Description of change

@@ -177,6 +179,7 @@ const { news, user } = await app.toPromise(ctx.service.biz.list(topic, uid));
- [toAsyncFunction][app.toAsyncFunction] 和 [toPromise][app.toPromise] 实际使用的是 [co] 包装,因此会带回对应的性能损失和堆栈问题,建议开发者还是尽量全链路升级。
- [toAsyncFunction][app.toAsyncFunction] 在调用 async function 时不会有损失。

@sindresorhus 编写了许多[基于 promise 的 helper 方法](https://github.com/sindresorhus/promise-fun),灵活的运用它们配合 async function 能让代码更加具有可读性。
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

async 那篇一些内容移到这边来了


- 底层基于 Koa 1.x,异步解决方案基于 [co] 封装的 generator function。
- 官方插件以及 Egg 核心使用 generator function 编写,保持对 Node.js LTS 版本的支持,在必要处通过 co 包装以兼容在 async function 中的使用。
- 应用开发者可以选择 async function(Node.js 7.6+) 或者 generator function(Node.js 6.0+)进行编写,**我们推荐 generator function 方案以确保应用可以运行在 Node.js LTS 版本上**
- 应用开发者可以选择 async function(Node.js 7.6+) 或者 generator function(Node.js 6.0+)进行编写。
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Node 8 吧

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

改了

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

还有英文的

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@popomore
Copy link
Member

有个链接挂了

@atian25
Copy link
Member Author

atian25 commented Nov 29, 2017

fixed

@atian25 atian25 force-pushed the docs-2.x-async-function branch from fdeea3b to 8189a2b Compare November 29, 2017 01:11
@atian25
Copy link
Member Author

atian25 commented Nov 29, 2017

合了?

@popomore popomore merged commit d043148 into master Nov 29, 2017
@popomore popomore deleted the docs-2.x-async-function branch November 29, 2017 05:23
popomore pushed a commit that referenced this pull request Nov 29, 2017
docs: remove async-function (#1713)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants