Skip to content

Conversation

@jysperm
Copy link
Contributor

@jysperm jysperm commented Jan 25, 2016

代码很简单,不过最后两个测试跑不过,正在检查

@jysperm
Copy link
Contributor Author

jysperm commented Jan 25, 2016

目前最后一个跑不过的测试是 Node SDK 的问题,稍后会更新云引擎的代码 已更新。

@sdjcw 因为 JavaScript SDK 在前端跨域时需要在请求正文上附加 appId 和 appKey, 所以请求正文必须是 Object 而不能是 Array, 所以暂时不允许给 rpc 传递一个数组参数,这个还有待商榷,因为这个功能在设计上是打算支持数组的。

@sdjcw
Copy link

sdjcw commented Jan 26, 2016

是有有必要再包装一层,方便后续扩展?变成:

{
  _ApplicationId: 'xxx'
  ...
  _body: {} | []
}

@killme2008

@jysperm jysperm changed the title [WIP] 添加 AV.Cloud.rpc 方法 添加 AV.Cloud.rpc 方法 Jan 26, 2016
@jysperm
Copy link
Contributor Author

jysperm commented Jan 27, 2016

@leeyeh @wangxiao RPC 支持开发完了~ 添加的测试在浏览器和 Node 也都跑过了。

Copy link
Contributor

Choose a reason for hiding this comment

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

这里返回 undefined 会有上次抢红包同样的问题。不论什么情况,都应该返回 Promise 以及 call 回调,或者直接抛异常。

@jysperm
Copy link
Contributor Author

jysperm commented Jan 29, 2016

@wujun4code 这里包括一个新的 API:

AV.Cloud.rpc = function(name, data, options)

name 是云函数名称,data 是发给云函数的参数对象,options 里是 success 和 error 回调。

@wujun4code
Copy link

这个 API 命名和参数 我没异议。可以。

@sdjcw
Copy link

sdjcw commented Feb 2, 2016

我没问题了。

Copy link
Contributor

Choose a reason for hiding this comment

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

这个还是没有 run callbacks。

@jysperm
Copy link
Contributor Author

jysperm commented Feb 15, 2016

继续求合并

@leeyeh
Copy link
Contributor

leeyeh commented Feb 15, 2016

LGTM

test/cloud.js Outdated
describe('#rpc', function() {
it('receive complex object', function(done) {
AV.Cloud.rpc('complexObject', null, {
success: function(result) {
Copy link
Contributor

Choose a reason for hiding this comment

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

测试用例及文档中,都使用 promise 的形式。

@codecov-io
Copy link

Current coverage is 63.28%

Merging #214 into master will increase coverage by +0.83% as of 3551406

@@            master    #214   diff @@
======================================
  Files           24      24       
  Stmts         2653    2669    +16
  Branches         0       0       
  Methods          0       0       
======================================
+ Hit           1657    1689    +32
  Partial          0       0       
+ Missed         996     980    -16

Review entire Coverage Diff as of 3551406

Powered by Codecov. Updated on successful CI builds.

@wangxiao
Copy link
Contributor

LGTM

wangxiao added a commit that referenced this pull request Feb 15, 2016
@wangxiao wangxiao merged commit f2f91dc into leancloud:master Feb 15, 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

Successfully merging this pull request may close these issues.

7 participants