Skip to content

Instantly share code, notes, and snippets.

@ichiroku11
Created January 26, 2018 06:02
Show Gist options
  • Select an option

  • Save ichiroku11/60d6cbbb23fe56f9982611514419500a to your computer and use it in GitHub Desktop.

Select an option

Save ichiroku11/60d6cbbb23fe56f9982611514419500a to your computer and use it in GitHub Desktop.
Promiseのサンプル
// https://developer.mozilla.org/ja/docs/Web/JavaScript/Reference/Global_Objects/Promise
// resolveとrejectは関数
const promise = new Promise((resolve, reject) => {
// 3秒後にresolveする
setTimeout(() => resolve(1), 3000);
});
// resolveされたときのコールバック
promise.then(value => console.log(value));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment