cytoplasmic
    Preparing search index...

    Function $

    • Experimental

      Utility function for creating computational cells that automatically track dependencies. Use zipWith if you want to explicitly specify dependencies. The same function is used both to unwrap cells and to create computed cells.

      Type Parameters

      • T

      Parameters

      • cell: Cell<T>

        A cell to track and unwrap.

      Returns T

      The value of the cell.

    • Create a computed cell. Do not use cell.value inside the computation, always us $(cell) to unwrap cells to properly track dependencies.

      Type Parameters

      • T

      Parameters

      • computation: () => T

        A function that can unwrap cells using $(cell) and compute a resulting value.

      Returns Cell<T>

      A cell that computes its value based on the provided computation function.

      In the following example c and d are equivalent:

      const a = cell(1);
      const b = cell(2);
      const c = $(() => $(a) + $(b));
      const d = zipWith([a, b], (a, b) => a + b);