diff options
author | Holden Rohrer <holden.rohrer@gmail.com> | 2020-01-08 21:10:04 -0500 |
---|---|---|
committer | Holden Rohrer <holden.rohrer@gmail.com> | 2020-01-08 21:10:04 -0500 |
commit | ed9d3b42125a8fb6f54b6e6521f067ec7e7d8b62 (patch) | |
tree | 0b7a9fff2f4210bec9e44e9eaa5843944f75080f | |
parent | 492af8740f40cb3370dcd11b4f5f27306f21c7fd (diff) |
added clear.js
-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');}); |