参考:官方
术语
promise:一个function 或者Object 紧跟then方法的
thenable:用来指定的then方法的function或者Object
value:including undefined, a thenable, or a promise
exception:throw 抛出异常
throw: is a value that indicates why a promise was rejected
声明 promise states
pending:等待
fulfilled:成功
rejected:失败
1.promise.then(onFulfilled, onRejected)
如果onFulfilled或者onRejected不是函数,那就忽略
If onFulfilled is not a function, it must be ignored.
2.如果onFulfilled或者onRejected是函数
promise2 = promise1.then(onFulfilled, onRejected);
以上是个人笔记,参考者需要有自己的理解
node之 promise
最新推荐文章于 2021-08-08 23:52:02 发布