RAGS - v1.10.0
    Preparing search index...

    Function merge

    • Combines multiple Bindings into a single derived binding.

      Whenever any dependency emits a property change, the function is re-evaluated with all current values and the result binding updates.

      Type Parameters

      • V
      • const Deps extends Dep<unknown>[]
      • Args extends { [K in string | number | symbol]: Deps[K] extends Dep<T> ? T : never }

      Parameters

      • deps: Deps

        Array of bindings to observe

      • fn: (...args: Args) => V

        Function that receives all current values and returns the derived value

      Returns Binding<
          Variable<V>,

              | "$signals"
              | "is_listening"
              | "is_polling"
              | "is_disposed"
              | Exclude<
                  V extends (...args: any[]) => any ? never : "value",
                  "g_type_instance",
              >,
          V,
      >

      A binding of the derived value

      const label = Widget.Label({
      label: Utils.merge(
      [battery.bind('percent'), audio.bind('volume')],
      (bat, vol) => `Battery: ${bat}%, Volume: ${Math.round(vol * 100)}%`,
      ),
      });