Today I Learned

hashrocket A Hashrocket project

Synchronous XHR is deprecated

Sometimes before I've figured out the right pattern for my app I use the synchronous xhr to get some naive green for my tests.

  var isAsync = false
  var xhr = new XMLHttpRequest()
  xhr.open('post', '/things.json', isAsync)
  xhr.send(JSON.stringify({things: things}))

But this time I got a nice deprecation notice at the console.

Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience. For more help, check http://xhr.spec.whatwg.org/

And low and behold whatwg.org has a deprecation notice

See More #javascript TILs
Looking for help? At Hashrocket, our JavaScript experts launch scalable, performant apps on the Web, Android and iOS. Contact us and find out how we can help you.