mobx-bonsai
    Preparing search index...

    Function onDeepInterceptedChange

    • Registers a deep change listener on the provided node that is called BEFORE changes are committed.

      The listener is invoked whenever the node is about to undergo a change, such as additions, updates, or removals within its observable structure. This is called during the intercept phase, before the change is actually applied. This includes receiving events from both object and array mutations.

      Note: The listener is called before the change is committed, so the node still has its old state.

      The listener must return one of the following:

      • The received change object (possibly modified) to accept and apply the change
      • null to cancel the change and stop propagation to parent listeners

      The listener can also throw an exception to prevent the change (e.g., if an invariant isn't met).

      Parameters

      • node: object

        The node to attach the intercepted change listener to.

      • listener: NodeInterceptedChangeListener

        The callback function that is called when a change is about to occur. The listener receives a NodeInterceptedChange parameter and must return either the change object (to accept it) or null (to cancel it).

      Returns _Dispose

      A disposer function that, when invoked, unregisters the listener.