FetchAPI

https://developer.mozilla.org/ja/docs/Web/API/Fetch_API/Using_Fetch
http://jxck.hatenablog.com/entry/whatwg-fetch
XMLHttpRequest の後継となる非同期通信用DOM API
WHATWGによって標準化されている。
以下のように使う。

fetch("http://example.com/file.html")
.then*1
.then*2
.catch*3;



ちなみにfetch()はpromiseしか返さないのでストリームデータを扱えない。
その問題についてはStreamAPIというのが別に定義されているらしい。

*1:response) => response.text(

*2:text) => console.log(text

*3:error) => console.log(error