aboutsummaryrefslogtreecommitdiff
path: root/examples/nword.js
diff options
context:
space:
mode:
authorHolden Rohrer <hr@hrhr.dev>2020-07-17 10:24:43 -0400
committerHolden Rohrer <hr@hrhr.dev>2020-07-17 10:24:43 -0400
commit5701e8eeca777f55caff46c63b0fc68439da59ca (patch)
tree810a822255fcf9b1d479aac757ad0e17212ed7a6 /examples/nword.js
parent7348d5ea68b9489b103c3c954c24c884b457e12a (diff)
now always clears all words in block but maintains lecture
Diffstat (limited to 'examples/nword.js')
-rw-r--r--examples/nword.js9
1 files changed, 4 insertions, 5 deletions
diff --git a/examples/nword.js b/examples/nword.js
index d42d0d4..5012bea 100644
--- a/examples/nword.js
+++ b/examples/nword.js
@@ -62,16 +62,15 @@ function makeclean(resp, reg){
let response = new Space().adhoc(resp);
let regex = new RegExp(reg,'g');
function clean(coord, send, space){
- let out;
+ let out = new Space().adhoc(space.print().replace(regex,
+ match=>' '.repeat(match.length)));
if (!lecture[send]){
response.loc = coord;
- out = response;
+ out.comb(response, comb.add);
lecture[send] = true;
setTimeout(() => {delete lecture[send];}, 1000);
- }else{
- out = new Space().adhoc(space.print().replace(regex,
- match=>' '.repeat(match.length))).comb(space, comb.sub);
}
+ out.comb(space, comb.sub);
ids.push(wq.enqueue(out.towrite()));
idcall.push(() => {search.update(response);});
}