Skip to content

Instantly share code, notes, and snippets.

@harukaeru
Created November 21, 2017 12:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save harukaeru/65f7c2be27cb02221fc13a67864164ae to your computer and use it in GitHub Desktop.
Save harukaeru/65f7c2be27cb02221fc13a67864164ae to your computer and use it in GitHub Desktop.
ES6
const wait = time => new Promise(resolve => setTimeout(resolve, time))
const x = (...args) => {
console.log('-----------------------------')
console.log(...args)
}
wait(1000)
.then(() => fetch('https://www.google.co.jp', { header: "same-origin" }))
.then(response => response.text())
.then(text => x('this is the response', text))
.catch(e => console.error(e))
@harukaeru
Copy link
Author

www.google.co.jpで実行しないとthenが呼ばれないです

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment