public interface PromiseHook
| Modifier and Type | Field and Description |
|---|---|
static int |
TYPE_AFTER
PromiseHook with type
TYPE_AFTER is called right at the end of the
PromiseReactionJob. |
static int |
TYPE_BEFORE
PromiseHook with type
TYPE_BEFORE is called at the beginning of the
PromiseReactionJob. |
static int |
TYPE_INIT
PromiseHook with type
TYPE_INIT is called when a new promise is created. |
static int |
TYPE_RESOLVE
PromiseHook with type
TYPE_RESOLVE is called at the beginning of resolve or reject
function defined by CreateResolvingFunctions. |
| Modifier and Type | Method and Description |
|---|---|
void |
promiseChanged(int changeType,
JSDynamicObject promise,
JSDynamicObject parentPromise)
Invoked for each important change in the life-cycle of a promise.
|
static final int TYPE_INIT
TYPE_INIT is called when a new promise is created.static final int TYPE_RESOLVE
TYPE_RESOLVE is called at the beginning of resolve or reject
function defined by CreateResolvingFunctions.static final int TYPE_BEFORE
TYPE_BEFORE is called at the beginning of the
PromiseReactionJob.static final int TYPE_AFTER
TYPE_AFTER is called right at the end of the
PromiseReactionJob.void promiseChanged(int changeType,
JSDynamicObject promise,
JSDynamicObject parentPromise)
changeType - type of the change: PromiseHook.TYPE_INIT, PromiseHook.TYPE_RESOLVE,
PromiseHook.TYPE_BEFORE or PromiseHook.TYPE_AFTER.promise - promise being changed.parentPromise - parent promise when the promise is created (PromiseHook.TYPE_INIT change
type) by Promise.then/race/all or AsyncFunctionAwait. The parent
promise is undefined in all other cases.