Interface PromiseHook
public interface PromiseHook
Provides information about the life-cycle of promises.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intPromiseHook with typeTYPE_AFTERis called right at the end of thePromiseReactionJob.static final intPromiseHook with typeTYPE_BEFOREis called at the beginning of thePromiseReactionJob.static final intPromiseHook with typeTYPE_INITis called when a new promise is created.static final intPromiseHook with typeTYPE_RESOLVEis called at the beginning of resolve or reject function defined byCreateResolvingFunctions. -
Method Summary
Modifier and TypeMethodDescriptionvoidpromiseChanged(int changeType, JSDynamicObject promise, JSDynamicObject parentPromise) Invoked for each important change in the life-cycle of a promise.
-
Field Details
-
TYPE_INIT
static final int TYPE_INITPromiseHook with typeTYPE_INITis called when a new promise is created.- See Also:
-
TYPE_RESOLVE
static final int TYPE_RESOLVEPromiseHook with typeTYPE_RESOLVEis called at the beginning of resolve or reject function defined byCreateResolvingFunctions.- See Also:
-
TYPE_BEFORE
static final int TYPE_BEFOREPromiseHook with typeTYPE_BEFOREis called at the beginning of thePromiseReactionJob.- See Also:
-
TYPE_AFTER
static final int TYPE_AFTERPromiseHook with typeTYPE_AFTERis called right at the end of thePromiseReactionJob.- See Also:
-
-
Method Details
-
promiseChanged
Invoked for each important change in the life-cycle of a promise.- Parameters:
changeType- type of the change:TYPE_INIT,TYPE_RESOLVE,TYPE_BEFOREorTYPE_AFTER.promise- promise being changed.parentPromise- parent promise when the promise is created (TYPE_INITchange type) byPromise.then/race/allorAsyncFunctionAwait. The parent promise isundefinedin all other cases.
-