From ecbd6efb3d89b50881f5f971fb3a4ec2e4b43d39 Mon Sep 17 00:00:00 2001
From: Holden Rohrer
Date: Fri, 10 Jan 2020 20:40:34 -0500
Subject: jarvis.js made more robust
Instead of failing whenever a tileUpdate was sent before the first "sender" notification, tileHandler only works after init happens.
---
examples/jarvis.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'examples')
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];
--
cgit