Forest.js Core Documentation - v1.2.3
    Preparing search index...

    Function createUtility

    • createUtility

      Type Parameters

      • E extends Element

        Element type.

      Parameters

      • fn: (el: E) => void

        The function to be executed.

      Returns Utility<E>

      A utility function that processes the element.

      Creates a utility function that enqueues a function to be executed on the next tick. Useful for batching updates to avoid layout thrashing.

      const delayedUpdate = createUtility<HTMLDivElement>((el) => {
      el.style.color = "blue";
      return el;
      });