Interface PromiseHook


public interface PromiseHook
Provides information about the life-cycle of promises.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    PromiseHook with type TYPE_AFTER is called right at the end of the PromiseReactionJob.
    static final int
    PromiseHook with type TYPE_BEFORE is called at the beginning of the PromiseReactionJob.
    static final int
    PromiseHook with type TYPE_INIT is called when a new promise is created.
    static final int
    PromiseHook with type TYPE_RESOLVE is called at the beginning of resolve or reject function defined by CreateResolvingFunctions.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    promiseChanged(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_INIT
      PromiseHook with type TYPE_INIT is called when a new promise is created.
      See Also:
    • TYPE_RESOLVE

      static final int TYPE_RESOLVE
      PromiseHook with type TYPE_RESOLVE is called at the beginning of resolve or reject function defined by CreateResolvingFunctions.
      See Also:
    • TYPE_BEFORE

      static final int TYPE_BEFORE
      PromiseHook with type TYPE_BEFORE is called at the beginning of the PromiseReactionJob.
      See Also:
    • TYPE_AFTER

      static final int TYPE_AFTER
      PromiseHook with type TYPE_AFTER is called right at the end of the PromiseReactionJob.
      See Also:
  • Method Details

    • promiseChanged

      void promiseChanged(int changeType, JSDynamicObject promise, JSDynamicObject parentPromise)
      Invoked for each important change in the life-cycle of a promise.
      Parameters:
      changeType - type of the change: TYPE_INIT, TYPE_RESOLVE, TYPE_BEFORE or TYPE_AFTER.
      promise - promise being changed.
      parentPromise - parent promise when the promise is created (TYPE_INIT change type) by Promise.then/race/all or AsyncFunctionAwait. The parent promise is undefined in all other cases.