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

有提问 #38

Closed
Honsec opened this issue Aug 21, 2016 · 1 comment
Closed

有提问 #38

Honsec opened this issue Aug 21, 2016 · 1 comment

Comments

@Honsec
Copy link

Honsec commented Aug 21, 2016

添加到队列

RequestQueue requestQueue = NoHttp.newRequestQueue();
// 或者传一个并发值,允许三个请求同时并发
// RequestQueue requestQueue = NoHttp.newRequestQueue(3);

// 发起请求
requestQueue.add(what, request, responseListener);
  上面添加到队列时有一个what,这个what会在responseLisetener响应时回调给开发者,所以我们可以用一个responseLisetener接受多个请求的响应,用what来区分结果。而不用像有的框架一样,每一个请求都要new一个回调。

这个而不用像有的框架一样,每一个请求都要new一个回调。 我觉得还是每次请求都new 一个比较好。
这样不得把很多request 结果处理写到一个listener里头啊

@yanzhenjie
Copy link
Owner

并不是,这样是你多了选择,你可以多个请求用一个Listener,也可以每个请求重新new。就像handler的waht一样。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants