Skip to content

Conversation

@dead-horse
Copy link
Member

@dead-horse dead-horse commented Feb 9, 2017

Checklist
  • npm test passes
  • tests and/or benchmarks are included
  • commit message follows commit guidelines
Affected core subsystem(s)

view

Description of change

remove generator function api to support async functions

@mention-bot
Copy link

@dead-horse, thanks for your PR! By analyzing the history of the files in this pull request, we identified @fengmk2, @popomore and @atian25 to be potential reviewers.

*/
* render(name, locals) {
this.body = yield this.renderView(name, locals);
render(name, locals) {
Copy link
Member

Choose a reason for hiding this comment

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

这里还涉及到几个地方的关联修改:

  • view 插件规范文档
  • egg-view-nunjucks 插件里面的基类也要改为 promise base 的, break change 了吧
Copy link
Member

Choose a reason for hiding this comment

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

喔, 记错了, 插件里面就是 promise .

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.

恩,基类我看都是 promise base

Copy link
Member Author

Choose a reason for hiding this comment

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

文档中的 * render() 改掉了

@codecov
Copy link

codecov bot commented Feb 9, 2017

Codecov Report

Merging #343 into master will not change coverage.

@@ Coverage Diff @@ ## master #343 +/- ## ===================================== Coverage 100% 100% ===================================== Files 28 28 Lines 635 636 +1 ===================================== + Hits 635 636 +1
Impacted Files Coverage Δ
app/extend/context.js 100% <100%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6dd9feb...dae9f2a. Read the comment docs.

- `app.View` 也是一个惰性实例化的单例,该 View 类继承于插件里面扩展的 `app[Symbol.for('egg#view')]`
- 该子类会在原 render 方法的基础上,增加对 locals 的注入。

有兴趣的同学可以看下对应的源码:
Copy link
Member

Choose a reason for hiding this comment

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

上面的 app.View 那段好像不准确了吧? @popomore 貌似改过了.

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 Author

Choose a reason for hiding this comment

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

那个另起 PR 改吧,这次只改 generator function 相关的

Copy link
Member

Choose a reason for hiding this comment

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

@popomore popomore merged commit c6914e0 into master Feb 9, 2017
@popomore popomore deleted the view-promise branch February 9, 2017 11:07
@dead-horse dead-horse mentioned this pull request Feb 10, 2017
9 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

5 participants