File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed
Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -87,7 +87,12 @@ func (p *Promise) Result() *Value {
8787}
8888
8989// Then invokes the given function when the promise has been fulfilled, not rejected.
90- // The returned Promise resolves after the given function has finished execution.
90+ //
91+ // The returned Promise resolves after the callback finishes execution.
92+ //
93+ // V8 only invokes the callback when processing "microtasks".
94+ // The default MicrotaskPolicy processes them when the call depth decreases to 0.
95+ // Call (*Context).PerformMicrotaskCheckpoint to trigger it manually.
9196func (p * Promise ) Then (cb FunctionCallback ) * Promise {
9297p .ctx .register ()
9398defer p .ctx .deregister ()
@@ -97,7 +102,7 @@ func (p *Promise) Then(cb FunctionCallback) *Promise {
97102}
98103
99104// Then2 invokes one of the given functions when the promise is fulfilled or rejected.
100- // The returned Promise resolves after the callback has finished execution .
105+ // See Then for other details .
101106func (p * Promise ) Then2 (onFulfilled , onRejected FunctionCallback ) * Promise {
102107p .ctx .register ()
103108defer p .ctx .deregister ()
@@ -108,7 +113,7 @@ func (p *Promise) Then2(onFulfilled, onRejected FunctionCallback) *Promise {
108113}
109114
110115// Catch invokes the given function if the promise is rejected.
111- // The returned Promise resolves after the callback has finished execution .
116+ // See Then for other details .
112117func (p * Promise ) Catch (cb FunctionCallback ) * Promise {
113118p .ctx .register ()
114119defer p .ctx .deregister ()
You can’t perform that action at this time.
0 commit comments