• React Hook that updates when the specified value of the given Pixel changes.

    Type Parameters

    Parameters

    • pixel: undefined | Pixel

      A Pixel for which to watch a value.

    • valueName: T

      The name of the value to watch, see keys of UsePixelValueNamesMap for the complete list.

    • Optionaloptions: {
          explicitStart?: boolean;
          minInterval?: number;
      }

      Optional arguments.

      • OptionalexplicitStart?: boolean

        Whether to wait on a call to the dispatcher with "start" before watching the value. Otherwise the hook returns the required value as soon the Pixel is connected.

        false
        
      • OptionalminInterval?: number

        The minimum time interval in milliseconds between two updates. Ignored for "roll" value.

        5000
        

    Returns [UsePixelValueNamesMap[T] | undefined, ((action: "start" | "stop") => void), Error?]

    An array with:

    • the value being watched,
    • a stable dispatch function that may be called to start and stop watching the Pixel's value,
    • the last encountered error.
    • By default this hook immediately starts watching the Pixel's value. See the function arguments to change that behavior.
    • The returned value is kept even after a disconnection event.