alf.nu / @steike

Mirror

Cross-machine copy-paste

To get to this page, go to m.alf.nu/key. Paste in the box below, it will be mirrored in browsers with the same key.

Code


var w = new WebSocket('wss://alf.nu/q/m-' + key);
w.onmessage = function(e) {
  tf.value = e.data;
};

var box, pending;
function update(text) {
  box = text.value;
  var d = Date.now();
  if (!pending) {
    w.send(box);
    pending = setTimeout(function() {
      pending = 0;
      box && w.send(box);
    }, 1000);  
  }
}

Complaints to @steike