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

Updated ts with new option #36

Merged
merged 4 commits into from
Dec 23, 2014
Merged

Updated ts with new option #36

merged 4 commits into from
Dec 23, 2014

Conversation

JamesThorpe
Copy link
Contributor

Added maxReconnectInterval to .ts file.

Bit new to git/github, so hope I've done the new branch/pull request correctly...

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);
Copy link
Owner

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)

@JamesThorpe
Copy link
Contributor Author

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. */
Copy link
Owner

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

@JamesThorpe
Copy link
Contributor Author

Sorry... IDE didn't know what a .ts was and decided to use a tab rather than spaces, I didn't notice...

@joewalnes joewalnes closed this Dec 23, 2014
@joewalnes joewalnes reopened this Dec 23, 2014
joewalnes added a commit that referenced this pull request Dec 23, 2014
Updated ts with new option
@joewalnes joewalnes merged commit bc8d6cc into joewalnes:master Dec 23, 2014
@joewalnes
Copy link
Owner

Merged thanks (after I clicked the wrong button). All good now :)

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

Successfully merging this pull request may close these issues.

2 participants