-
Notifications
You must be signed in to change notification settings - Fork 110
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
added request.setTimeout support #80
base: master
Are you sure you want to change the base?
Conversation
// set and handle the timeout signals on xhr | ||
if (this.xhr) { | ||
if (this.timeoutCb) { | ||
this.xhr.ontimeout = this.timeoutCb; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could be:
this.xhr.ontimeout = this.emit.bind(this, 'timeout')
Depends on whether you prefer anonymous closures though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I pretty much ported directly from the node implementation, but used the xhr-provided timeout scaffolding. The this.once('timeout', callback)
just adds a one-time event handler. It shouldn't call back immediately.
I'm gonna be doing a little more testing with your binding/emit code. It's a lot cleaner.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, sorry. My mistake. LGTM otherwise :)
I've tested fa18e1f with my target libs. Looking good. |
Could you add a basic test for this?
|
Yeah, I'll work on something. It's complicated, because so much of this depends on |
I wrote two tests. One to make sure |
If nobody objects or has comments ... @substack ? |
@substack any comments on this? thx |
Would it be possible to get this merged? |
I believe someone willing to do it would have to ask @substack on twitter for repository and maintainer rights on this project. If he feels like he will have the bandwidth and will to do so. |
I spoke with substack on IRC a while back about this and it turns out browserify is now using |
Yes if you are using the latest browserify. Some people may not but not sure we need to fix this :) Then the next step would be to deprecate this module officially in the README, close issues and PRs. |
This is a port of node's request http
setTimeout
method.