aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHolden Rohrer <hr@hrhr.dev>2020-01-10 20:40:34 -0500
committerHolden Rohrer <hr@hrhr.dev>2020-01-10 20:40:34 -0500
commitecbd6efb3d89b50881f5f971fb3a4ec2e4b43d39 (patch)
treecea96140d07907ee70ee45a454160d9d4b77db15
parent3b4d856c61a638d92928812378d03c9c3abcce0d (diff)
jarvis.js made more robust
Instead of failing whenever a tileUpdate was sent before the first "sender" notification, tileHandler only works after init happens.
-rw-r--r--examples/jarvis.js2
1 files changed, 1 insertions, 1 deletions
diff --git a/examples/jarvis.js b/examples/jarvis.js
index 81547a9..31b0513 100644
--- a/examples/jarvis.js
+++ b/examples/jarvis.js
@@ -18,7 +18,6 @@ main.on('close', deinit);
//// tileUpdates require knowledge of the prog's identity (sender)
var sender;
-main.on('tileUpdate', tileHandler);
//// Configurable helpers for utilities
function init(send){
@@ -32,6 +31,7 @@ function deinit(){
function initOnce(){
timect();
+ main.on('tileUpdate', tileHandler); // Should only be active after the "control space" of the notification has been established
}
var funcs = [protectArea, detectPrompt];