promiseResolve(asyncId)
asyncId
<number>
当调用传给 Promise
构造函数的 resolve
函数时调用(直接或通过其他解决 promise 的方法)。
resolve()
不做任何可观察到的同步工作。
如果 Promise
是通过假设另一个 Promise
的状态来解决的,则此时 Promise
不一定满足或拒绝。
new Promise((resolve) => resolve(true)).then((a) => {});
调用以下回调:
init for PROMISE with id 5, trigger id: 1
promise resolve 5 # 对应于 resolve(true)
init for PROMISE with id 6, trigger id: 5 # then() 返回的 Promise
before 6 # 输入 then() 回调
promise resolve 6 # then() 回调通过返回来解决 promise
after 6
asyncId
<number>
Called when the resolve
function passed to the Promise
constructor is
invoked (either directly or through other means of resolving a promise).
resolve()
does not do any observable synchronous work.
The Promise
is not necessarily fulfilled or rejected at this point if the
Promise
was resolved by assuming the state of another Promise
.
new Promise((resolve) => resolve(true)).then((a) => {});
calls the following callbacks:
init for PROMISE with id 5, trigger id: 1
promise resolve 5 # corresponds to resolve(true)
init for PROMISE with id 6, trigger id: 5 # the Promise returned by then()
before 6 # the then() callback is entered
promise resolve 6 # the then() callback resolves the promise by returning
after 6