Skip to content

Commit

Permalink
feat: reset(options)
Browse files Browse the repository at this point in the history
implement handling of options.interval as a number
  • Loading branch information
nathanstilwell committed Feb 27, 2016
1 parent 01b1b6e commit 5ebe0d9
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion lib/reset.js
Expand Up @@ -3,9 +3,19 @@ module.exports = reset
var Promise = require('lie')
var cache = require('./utils/cache')

function reset (state) {
function reset (state, o) {
var options = o || {}
state.timestamp = undefined
state.error = undefined

if (typeof options.interval === 'number') {
var intervalTimeValue = options.interval
state.interval = {
connected: intervalTimeValue,
disconnected: intervalTimeValue
}
}

cache.set(state)

if (state.request) {
Expand Down

0 comments on commit 5ebe0d9

Please sign in to comment.