Skip to content

Commit

Permalink
add .reset()
Browse files Browse the repository at this point in the history
  • Loading branch information
juliangruber committed Oct 21, 2015
1 parent adb4e5c commit fcd320c
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
3 changes: 3 additions & 0 deletions README.md
Expand Up @@ -52,6 +52,9 @@ re.disconnect();

// ...or prevent reconnecting
re.reconnect = false;

// reset the internal backoff timer
re.reset();
```

## Available implementations
Expand Down
4 changes: 4 additions & 0 deletions index.js
Expand Up @@ -117,6 +117,10 @@ function (createConnection) {
return emitter
}

emitter.reset = function () {
backoffMethod.reset()
}

return emitter
}

Expand Down
14 changes: 14 additions & 0 deletions test/reset.js
@@ -0,0 +1,14 @@

var inject = require('..')
var test = require('tape')
var Stream = require('stream')

var reconnect = inject(function () {
return new Stream
})

test('reset', function (t) {
// TODO real test
reconnect().reset()
t.end()
})

0 comments on commit fcd320c

Please sign in to comment.