diff options
-rw-r--r-- | examples/clear.js | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/examples/clear.js b/examples/clear.js new file mode 100644 index 0000000..e845c55 --- /dev/null +++ b/examples/clear.js @@ -0,0 +1,28 @@ +// Demonstrates large-scale changes using tools/queue.js; pastes a character (once) over a large area + +// This demo puts a bunch of z's on yourworldoftext.com/zworld (scroll up because it's a big area) +const Socket = require('../socket.js'); +const Space = require('../space.js'); +const Queue = require('../tools/queue.js'); + +let width = 801; +let height = 801; +let sends = width*height; + +let copyspace = new Space(); +copyspace.loc = [-400,-400]; + +let row = 'z'.repeat(width)+'\n'; +let tot = row.repeat(height); +copyspace.adhoc(tot); + +let main = new Socket('zworld'); +let writect = 0; +let writes = new Queue(1000, 200, w => { + main.write(w); + writect += 200; + console.log(writect + '/' + sends)}); + +writes.enqueue(copyspace.towrite()); + +main.on('open',()=>{writes.enable(); console.log('enabled');}); |