-
Notifications
You must be signed in to change notification settings - Fork 119
添加 AV.Cloud.rpc 方法 #214
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
添加 AV.Cloud.rpc 方法 #214
Conversation
|
@sdjcw 因为 JavaScript SDK 在前端跨域时需要在请求正文上附加 appId 和 appKey, 所以请求正文必须是 Object 而不能是 Array, 所以暂时不允许给 rpc 传递一个数组参数,这个还有待商榷,因为这个功能在设计上是打算支持数组的。 |
|
是有有必要再包装一层,方便后续扩展?变成: |
lib/cloudfunction.js
Outdated
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.
这里返回 undefined 会有上次抢红包同样的问题。不论什么情况,都应该返回 Promise 以及 call 回调,或者直接抛异常。
|
@wujun4code 这里包括一个新的 API: name 是云函数名称,data 是发给云函数的参数对象,options 里是 success 和 error 回调。 |
|
这个 API 命名和参数 我没异议。可以。 |
|
我没问题了。 |
lib/cloudfunction.js
Outdated
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.
这个还是没有 run callbacks。
|
继续求合并 |
|
LGTM |
test/cloud.js
Outdated
| describe('#rpc', function() { | ||
| it('receive complex object', function(done) { | ||
| AV.Cloud.rpc('complexObject', null, { | ||
| success: function(result) { |
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 的形式。
Current coverage is
|
|
LGTM |
代码很简单,
不过最后两个测试跑不过,正在检查