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

建议给 public api 包一层 co.wrap #87

Closed
magicdawn opened this issue Apr 1, 2016 · 6 comments
Closed

建议给 public api 包一层 co.wrap #87

magicdawn opened this issue Apr 1, 2016 · 6 comments

Comments

@magicdawn
Copy link

现在 对外暴露的 API 都是直接的 generator function, 只能配合着 co yield 使用。
包上一层 co.wrap 之后,api方法返回的是 Promise, 可以配合 yield / await / or直接then 使用。

@rockuw
Copy link
Collaborator

rockuw commented Apr 5, 2016

Good point!

@fengmk2 @dead-horse 怎么看?

@fengmk2
Copy link
Member

fengmk2 commented Apr 5, 2016

这个不由此模块来做,你可以发布一个新模块来做这件事情

@fengmk2
Copy link
Member

fengmk2 commented Apr 5, 2016

等async 变成node内置,我们会直接提供async接口

@dead-horse
Copy link
Member

增加一个 oss.createPromise 方法?

@magicdawn
Copy link
Author

但是 fn = co.wrap genfn 的结果就是一个async function啊。除了 fn.length 不一样外。

@rockuw
Copy link
Collaborator

rockuw commented Apr 14, 2016

@rockuw rockuw closed this as completed Apr 14, 2016
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

4 participants