From fdac79c026a2f6a321a1a3846c2f331bede6af02 Mon Sep 17 00:00:00 2001
From: Holden Rohrer
Date: Fri, 24 Jan 2020 18:15:09 -0500
Subject: jarvis changed in preparation for search refactor
---
examples/jarvis.js | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
(limited to 'examples')
diff --git a/examples/jarvis.js b/examples/jarvis.js
index 31a3443..79f0ca6 100644
--- a/examples/jarvis.js
+++ b/examples/jarvis.js
@@ -30,6 +30,7 @@ class MetaSocket extends Socket{
self.on('init',(send)=>{
self.sender = send;
});
+ Search.call(this);
}
}
var main = new MetaSocket('testworld');
@@ -110,19 +111,17 @@ function protectArea(send, tiles, locs, id, space, ctrl){
var search = new Space();
search.adhoc('jarvis'); // The search space is the word jarvis, so whenever that's caught, a relevant function can be called.
-var read = new Search(search);
+var read = new Search();
+read.match(search, respond);
var expire = {};
main.on('fallback', (send, tiles, locs) => { // tries to detect the prompt ('jarvis') and calls respond if found.
- for (let i=0; i 0) respond(results, send);
+ read.add(loc, tiles[loc]);
expire[loc] = setTimeout(() => {read.del(loc); delete expire[loc];}, 30000);
}
});
--
cgit