Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Collaborative JS

Ben Foxall
August 10, 2016

Collaborative JS

How to build a collaborative browser-based editor (and why)

Ben Foxall

August 10, 2016
Tweet

More Decks by Ben Foxall

Other Decks in Technology

Transcript

  1. I've not really said this stuff yet 1. Tell me

    if we've been here too long 2. I'd be happy (and sorry) if you tell me this is rubbish
  2. !

  3. /

  4. The challenges —Making a textarea feel nice —Showing content —Code

    transpilation —External modules —Not breaking things
  5. Web based code editors (maybe don't write one yourself) —Ace

    Editor —Monaco —CodeMirror —~Atom~
  6. b = new Blob(['…'], {type: 'text/html'}) url = URL.createObjectURL(b) //

    "blob:https%3A/…/2084018…ab3a2cec02" // later URL.revokeObjectURL(url) !
  7. Bublé —inspired by Babel —no shims / polyfills —compact transforms

    only —less extensibility —fast —Nice one, Rich Harris
  8. rollup.rollup({ entry: '__main__', plugins:[ { resolveId: (i) => i, load:

    (id) => { if(id == '__main__') return source.value return fetch('/module/' + id + '.js') } } ] }).then(bundle => bundle.generate({ format: 'iife' }).code )
  9. jsbin/loop-protect Super props, Remy Sharp loopProtect(`for(var i = 99; i

    > 0; i++) { console.log(\`${i} bottles of beer\`) }`)
  10. {;loopProtect.protect({ line: 1, reset: true }); for(var i = 99;

    i > 0; i++) { if (loopProtect.protect({ line: 1 })) break; console.log(`${i} bottles of beer`) } !
  11. /

  12. /