From 5912a13ccb48313da191741931409a11b217d306 Mon Sep 17 00:00:00 2001 From: Holden Rohrer Date: Sat, 22 Feb 2020 22:56:41 +0000 Subject: removed global variable pollution --- examples/jarvis.js | 4 ++-- socket.js | 2 +- space.js | 3 ++- tools/claim.js | 6 +++--- tools/schedule.js | 4 ++-- tools/search.js | 2 +- utils/raster.js | 2 +- 7 files changed, 12 insertions(+), 11 deletions(-) diff --git a/examples/jarvis.js b/examples/jarvis.js index 4fc84a0..7268ad2 100644 --- a/examples/jarvis.js +++ b/examples/jarvis.js @@ -67,8 +67,6 @@ const notifsrc = '\ & git.hrhr.dev/ywot-clean \n\ & Try `COMMAND` today. Uptime: UPTIME. \n\ & Called: JARVISx ~SIGNATURE \n\ -& If you have any good bullet art (<100 chars),\n\ -& please send it to me at hr@hrhr.dev. \n\ '.replace('COMMAND', command).replace('SIGNATURE', sig); const notifloc = [0, 20]; var minsUp = 0; @@ -147,3 +145,5 @@ function respond(coord, send){ setTimeout(() => {limits.splice(limits.indexOf(send))}, 5*1000); limits.push(send); } + +setInterval(()=>{console.log('time ' + new Date().getTime());}, 60*1000); diff --git a/socket.js b/socket.js index d5243a2..4563ed5 100644 --- a/socket.js +++ b/socket.js @@ -49,7 +49,7 @@ class Socket extends retryws { this.fetch = function(coords){ //coords is a list of min/max pairs of y/x coordinate pairs which each describe at most 1000 tiles //Unchecked for speed - for (var i=0; i el.wacc-ne.wacc)){ + for (let job of jobq.slice().sort((el, ne) => el.wacc-ne.wacc)){ // Step 5: Iterate through array (high->low), and subtract 1 until the length of output is num. if (dequeued.length == num || job.data.length == 0) break; job.wacc--; diff --git a/tools/search.js b/tools/search.js index 78e0ee7..e365214 100644 --- a/tools/search.js +++ b/tools/search.js @@ -78,7 +78,7 @@ function Search(){ // searchBlock should be a Space object. this.update = function(space){ // Must be a space w/ valid loc; allows overlay of some arbitrary text (in the space) mostly for recording updates from the server without directly cataloguing them let tiles = raster(space); // Returns a this.tiles-style binding: {'2,-3':Space object} - for (tile in tiles){ + for (let tile in tiles){ if (this.tiles[tile]) this.tiles[tile].comb(tiles[tile], comb.flip(comb.add)); else this.add(tile, tiles[tile]); } diff --git a/utils/raster.js b/utils/raster.js index 1e17838..c1a204b 100644 --- a/utils/raster.js +++ b/utils/raster.js @@ -6,7 +6,7 @@ const vec = require('./vec'); module.exports = function(space){ // just use .subsection let tiles = {}; - dim = ms(space).map(coord => vec.charToTile(coord)); + let dim = ms(space).map(coord => vec.charToTile(coord)); for (let y=dim[0][0]; y<=dim[0][1]; y++) for (let x=dim[1][0]; x<=dim[1][1]; x++){ let tile = tileToChar([y,x]); tiles[tile] = space.subsection(tile, vec.add(tile, [8,16])); -- cgit