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

co.any() support? #93

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

co.any() support? #93

fengmk2 opened this issue Mar 10, 2014 · 2 comments

Comments

@fengmk2
Copy link
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.

@juliangruber
Copy link
Contributor

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

@jonathanong
Copy link
Contributor

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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants