## 2016-04-13, #Jens

Finally, I got the hang of streaming with fetch... it seems that it is not so easy..

based on https://jakearchibald.com/2015/thats-so-fetch/ 
```JS
// https://lively-kernel.org/lively4/lively4-core/templates/lively-container.html
fetch("https://lively-kernel.org/lively4/_git/diff", {
    headers: new Headers({ 
    	"gitrepository": "lively4-core",
    })
  }).then(function(response) {
  var reader = response.body.getReader();
  var decoder = new TextDecoder();


  (function read() {
    reader.read().then(function(result) {
      var text = decoder.decode(result.value || new Uint8Array, {
        stream: !result.done
      });
      console.log("RESULT " + text)
      if (result.done) {
        console.log("DONE")
      } else {
        read() // fetch next chunk
      }
    })
  })()
  
})

```

### Fun with Lively2 Loader

Lets shake it... 

```JS
window.r=0
function rockit() {
$('div').each(function() {
	this.style.transform = 'rotate('+(Math.random()*2*r - r)+'deg)'
})
r += 0.05

	setTimeout(rockit, 200)
}
rockit()
```

### Global Key Handler

I fixed general text selection in livley and added a global *DoIt* (CTRL+D) for selected text.


Try it out:
```
alert("hello")
```


But, we need to refactor keys.js and shortcuts.js into one. #TODO #REFACTOR



