タグ

ブックマーク / jakearchibald.com (1)

  • That's so fetch!

    There's been some confusion around the new fetch API recently. Let's clear things up. The first thing you'll notice about fetch is it's a massive improvement on XMLHttpRequest in terms of API design. Here's how to get some JSON using XHR: var xhr = new XMLHttpRequest(); xhr.open('GET', url); xhr.responseType = 'json'; xhr.onload = function () { console.log(xhr.response); }; xhr.onerror = function

    That's so fetch!
    naga_sawa
    naga_sawa 2019/11/21
    FetchAPI Stream受信処理/チャンク区切りで送られてくる場合はチャンク途中までの受信になる場合があるので、その端数処理が必要
  • 1