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

pomelo.request 的参数有问题 #1

Open
wulin9005 opened this issue Jul 26, 2013 · 3 comments
Open

pomelo.request 的参数有问题 #1

wulin9005 opened this issue Jul 26, 2013 · 3 comments

Comments

@wulin9005
Copy link

pomelo.request = function(route) {
console.log('i am in request');
if(!route) {
return;
}
var msg = {};
var cb;
arguments = Array.prototype.slice.apply(arguments);
if(arguments.length === 2){
console.log('i am in request arg = 2');
if(typeof arguments[1] === 'function'){
cb = arguments[1];
} else if(typeof arguments[1] === 'object'){
msg = arguments[1];
}
} else if(arguments.length === 3){
msg = arguments[1];
cb = arguments[2];
}

id++;
callbacks[id] = cb;
sendMessage(id, route, msg);

};

为何这里只有一个参数,搞不懂什么情况,而且websocket中此处也是3个参数,难道有什么他俩又什么不同吗

@wulin9005
Copy link
Author

为什么没有回应呢 这里提供的接口pomelo.request(route, params, callback); 也是有3个参数的

@xiecc
Copy link
Contributor

xiecc commented Aug 1, 2013

汗, 来 nodejs.netease.com 吧, 这边issue容易漏掉

On Thu, Aug 1, 2013 at 3:22 PM, wulin9005 [email protected] wrote:

为什么没有回应呢 这里提供的接口pomelo.request(route, params, callback); 也是有3个参数的


Reply to this email directly or view it on GitHubhttps://github.com//issues/1#issuecomment-21919322
.

@xiecc
Copy link
Contributor

xiecc commented Aug 1, 2013

javascript是动态参数的,因为后面params可能不传, 所以函数定义里没写。

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

2 participants