Skip to content

Commit

Permalink
feat: polling interval option support
Browse files Browse the repository at this point in the history
  • Loading branch information
kybarg committed Oct 15, 2024
1 parent 49418f8 commit ae608c8
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ const options = {
id: 0, // device id in case multiple acceptors connected to the host
timeout: 1000, // command response timeout after wich command considered failed
commandRetries: 20, // how many time to retry before throwing error or emitting ERROR event
pollingInterval: 300, // interval between poll messages
}
```

Expand Down
1 change: 1 addition & 0 deletions example.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ eSSP
channels: Array(channels.length).fill(1),
}),
)
// .then(() => eSSP.command('ENABLE'))
.then(() => eSSP.enable())
.then(() => {
console.log('GO!!!')
Expand Down
3 changes: 2 additions & 1 deletion lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ class SSP extends EventEmitter {
id: 0,
timeout: 1000,
commandRetries: 20,
pollingInterval: 300,
...otherConfig,
}

Expand Down Expand Up @@ -364,7 +365,7 @@ class SSP extends EventEmitter {
this.emit('ERROR', error)
}
},
Math.max(0, 200 - executionTime),
Math.max(0, this.config.pollingInterval - executionTime),
)

return result
Expand Down

0 comments on commit ae608c8

Please sign in to comment.