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

    Type Parameters

    Parameters

    • Optional pixel: Pixel

      A Pixel for which to watch a value.

    • Optional valueName: T

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

    • Optional options: {
          explicitStart?: boolean;
          minInterval?: number;
      }

      Optional arguments.

      • Optional explicitStart?: 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.

        Default Value

        false
        
      • Optional minInterval?: number

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

        Default Value

        5000
        

    Returns [UsePixelValueNamesMap[T] | undefined, ((action) => 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.

    Remarks

    • 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.

Generated using TypeDoc