Skip to content

Commit

Permalink
Move broadcast interval to onopen function (#34)
Browse files Browse the repository at this point in the history
* Move broadcast interval to onopen function

* Update version
  • Loading branch information
andycate authored Feb 6, 2019
1 parent fab8a8c commit 92ff2cd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ dependencies {
}

group = 'org.team5499'
version = '0.1.1' /* Change this when deploying a new version */
version = '0.1.2' /* Change this when deploying a new version */

task sourcesJar(type: Jar) {
from sourceSets.main.allJava
Expand Down
7 changes: 3 additions & 4 deletions src/main/resources/static/javascript/page.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,10 @@ class SocketHandler {
SocketHandler.socket.onopen = SocketHandler.onopen
SocketHandler.socket.onclose = SocketHandler.onclose
SocketHandler.socket.onmessage = SocketHandler.onmessage
}

static onopen(event) {
SocketHandler.isConnected = true;
SocketHandler.broadcastInterval = window.setInterval(function() {
// if changes, broadcast them
if (Object.keys(SocketHandler.variableUpdates).length > 0) {
Expand All @@ -200,10 +203,6 @@ class SocketHandler {
}

}, 1000.0 / SocketHandler.BROADCAST_INTERVAL);
}

static onopen(event) {
SocketHandler.isConnected = true;
console.warn("Robot connected!")
}

Expand Down

0 comments on commit 92ff2cd

Please sign in to comment.