-
Notifications
You must be signed in to change notification settings - Fork 969
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
Updated ts with new option #36
Conversation
Added an extra option to specify the maximum amount of time to wait before attempting a reconnect. Defaults to -1, to keep the current behaviour.
Now defaults to 30,000. Removed the -1 magic number. Added documentation on use.
setTimeout(function() { | ||
self.reconnectAttempts++; | ||
connect(true); | ||
}, self.reconnectInterval * Math.pow(self.reconnectDecay, self.reconnectAttempts)); | ||
}, timeout > self.maxReconnectInterval ? self.maxReconnectInterval : timeout); |
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.
Simplify: Max.min(timeout, self.maxReconnectInterval)
Ended up simplifying this on the original pull request |
@@ -23,6 +23,9 @@ declare class ReconnectingWebSocket | |||
/** The number of milliseconds to delay before attempting to reconnect. */ | |||
public reconnectInterval: number; | |||
|
|||
/** The maximum number of milliseconds to delay a reconnection attempt. */ |
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.
Indentation does not match rest of file
Sorry... IDE didn't know what a .ts was and decided to use a tab rather than spaces, I didn't notice... |
Merged thanks (after I clicked the wrong button). All good now :) |
Added maxReconnectInterval to .ts file.
Bit new to git/github, so hope I've done the new branch/pull request correctly...