mobx-keystone
    Preparing search index...

    Function onChildAttachedTo

    • Runs a callback everytime a new object is attached to a given node. The callback can optionally return a disposer which will be run when the child is detached.

      The optional options parameter accepts an object with the following options:

      • deep: boolean (default: false) - true if the callback should be run for all children deeply or false if it it should only run for shallow children.
      • fireForCurrentChildren: boolean (default: true) - true if the callback should be immediately called for currently attached children, false if only for future attachments.

      Returns a disposer, which has a boolean parameter which should be true if pending detachment callbacks should be run or false otherwise.

      Parameters

      • target: () => object

        Function that returns the object whose children should be tracked.

      • fn: (child: object) => void | (() => void)

        Callback called when a child is attached to the target object.

      • Optionaloptions: { deep?: boolean; fireForCurrentChildren?: boolean }

      Returns (runDetachDisposers: boolean) => void