码迷,mamicode.com
首页 > 其他好文 > 详细

Promise()

时间:2017-09-09 09:44:12      阅读:205      评论:0      收藏:0      [点我收藏+]

标签:sed   blank   created   .com   opera   before   bsp   return   ges   

Promise()

  The constructor is primarily used to wrap functions that do not already support promises.

  技术分享

executor

  A function that is passed with the arguments resolve and reject. The executor function is executed immediately by the Promise implementation, passing resolve and reject functions (the executor is called before the Promiseconstructor even returns the created object). 

  红字部分:executor在new Promise()返回前就被执行。

  

Promise is in one of these states:

  • pending: initial state, neither fulfilled nor rejected.
  • fulfilled: meaning that the operation completed successfully.
  • rejected: meaning that the operation failed.

参考:https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise

Promise()

标签:sed   blank   created   .com   opera   before   bsp   return   ges   

原文地址:http://www.cnblogs.com/tekkaman/p/7496938.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!