Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

co.any() support? #93

Closed
fengmk2 opened this Issue Mar 10, 2014 · 2 comments

Comments

Projects
None yet
3 participants
Collaborator

fengmk2 commented Mar 10, 2014

I want to request a url with timeout logic, code examples:

try {
  // return the first finished result
  var r = yield any(get('http://google.com'), timeout('1000ms'));
} catch (e) {
  console.log(e); // timeout or http request error
}

https://github.com/visionmedia/co/tree/master/examples only have parallel example.

Contributor

juliangruber commented Mar 10, 2014

you can already do that with https://github.com/eugeneware/co-first

Contributor

jonathanong commented Mar 10, 2014

i have https://github.com/cojs/assert-timeout for that, but doesn't belong in co

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