npms

  • es6-promise
  • promise
  • bluebird
  • Q

Promise with bludebird

npm install bluebird --save

<<<<<<< HEAD

References

+ Node.jsエンジニアなら2014年内に知っておきたいPromise入門

メソッド

Promise.resolve(value)

Promise.resolveはnew Promiseを簡略化するためのもので

https://developer.mozilla.org/ja/docs/Web/JavaScript/Reference/Global_Objects/Promise/resolve

静的なPromise.resolve メソッドを使う

Promise.resolve("Success").then(function(value) {
  console.log(value); // "Success"
}, function(value) {
  // not called
});

// es6 & value無し
Promise.resolve().then(() => {
  console.log('success'); // "Success"
}, function(value) {
  // not called
});

References

results matching ""

    No results matching ""