Skip to content

Commit

Permalink
updated for polling
Browse files Browse the repository at this point in the history
  • Loading branch information
hoeken committed Nov 29, 2023
1 parent 8456f82 commit 7b697d7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
7 changes: 3 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,14 @@ class YarrboardClient
startUpdatePoller(interval = 1000)
{
this.update_interval = interval;
setTimeout(this._updatePoller.bind(this), 1);
this._updatePoller();
}

_updatePoller()
{
if (!this.closed)
{
if (this.ws.readyState == ws.w3cwebsocket.OPEN)
this.getUpdate();

this.getUpdate();
setTimeout(this._updatePoller.bind(this), this.update_interval);
}
}
Expand Down Expand Up @@ -294,6 +292,7 @@ class YarrboardClient
_onclose(event) {
this.log(`Connection closed`);

this.closed = true;
this.onclose(event);

delete this.ws;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "yarrboard-client",
"version": "1.2.1",
"version": "1.3.0",
"description": "Client for Yarrboard",
"license": "ISC",
"repository": {
Expand Down

0 comments on commit 7b697d7

Please sign in to comment.