aboutsummaryrefslogtreecommitdiff
path: root/examples/clear.js
blob: e845c55b4efec875b8aadef0d57dae9cada0ec70 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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');});