Skip to content

Instantly share code, notes, and snippets.

@jhonnymoreira
Created April 20, 2017 14:22
Show Gist options
  • Save jhonnymoreira/b0dc417cb61e83c5c395c27c8b2cfb8a to your computer and use it in GitHub Desktop.
Save jhonnymoreira/b0dc417cb61e83c5c395c27c8b2cfb8a to your computer and use it in GitHub Desktop.
A few JavaScript Patterns with opinionated code based on Stoyan Stefanov's book: JavaScript Patterns
const request = new XMLHttpRequest
const URL = 'https://google.com.br'
// `async` by default, since the last function param is ommited
request.open('GET', URL)
request.send()
// use `load` instead of `ready` so there is no need to do more checks
// related to status code and stuff
request.addEventListener('load', handleResponse)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment