-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
feat: view base promise to support async function #343
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
Conversation
|
@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. |
b948eb9 to
da2cddd
Compare
| */ | ||
| * render(name, locals) { | ||
| this.body = yield this.renderView(name, locals); | ||
| render(name, locals) { |
There was a problem hiding this comment.
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 了吧
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
喔, 记错了, 插件里面就是 promise .
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
恩,基类我看都是 promise base
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
文档中的 * render() 改掉了
da2cddd to
409add8
Compare
Codecov Report@@ Coverage Diff @@
## master #343 +/- ##
=====================================
Coverage 100% 100%
=====================================
Files 28 28
Lines 635 636 +1
=====================================
+ Hits 635 636 +1
Continue to review full report at Codecov.
|
| - `app.View` 也是一个惰性实例化的单例,该 View 类继承于插件里面扩展的 `app[Symbol.for('egg#view')]` | ||
| - 该子类会在原 render 方法的基础上,增加对 locals 的注入。 | ||
|
|
||
| 有兴趣的同学可以看下对应的源码: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
上面的 app.View 那段好像不准确了吧? @popomore 貌似改过了.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
哪一段?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
那个另起 PR 改吧,这次只改 generator function 相关的
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
嗯
Checklist
npm testpassesAffected core subsystem(s)
view
Description of change
remove generator function api to support async functions