RAGS - v1.10.0
    Preparing search index...

    Function watch

    • Creates a binding that re-evaluates a callback whenever specified objects emit signals.

      Type Parameters

      • T

      Parameters

      • init: T

        The initial value

      • objs: (Connectable | [obj: Connectable, signal?: string])[]

        Connectable object(s) to watch, optionally with signal names

      • callback: () => T

        Callback if signal name was provided

      Returns B<T>

      A binding of the watched value

      const label = Widget.Label({
      label: Utils.watch('', audio, 'speaker-changed', () => {
      return `Volume: ${audio.speaker?.volume}`;
      }),
      });
    • Creates a binding that re-evaluates a callback whenever specified objects emit signals.

      Type Parameters

      • T

      Parameters

      • init: T

        The initial value

      • obj: Connectable
      • signal: string
      • callback: () => T

        Callback if signal name was provided

      Returns B<T>

      A binding of the watched value

      const label = Widget.Label({
      label: Utils.watch('', audio, 'speaker-changed', () => {
      return `Volume: ${audio.speaker?.volume}`;
      }),
      });
    • Creates a binding that re-evaluates a callback whenever specified objects emit signals.

      Type Parameters

      • T

      Parameters

      • init: T

        The initial value

      • obj: Connectable
      • callback: () => T

        Callback if signal name was provided

      Returns B<T>

      A binding of the watched value

      const label = Widget.Label({
      label: Utils.watch('', audio, 'speaker-changed', () => {
      return `Volume: ${audio.speaker?.volume}`;
      }),
      });