Pixel value names map for usePixelEvent function. Maps the value name with the corresponding data type.

interface UsePixelValueNamesMap {
    battery: Readonly<{
        isCharging: boolean;
        level: number;
    }>;
    roll: Readonly<{
        face: number;
        faceIndex: number;
        state:
            | "unknown"
            | "handling"
            | "rolling"
            | "crooked"
            | "rolled"
            | "onFace";
    }>;
    rollFace: Pick<Readonly<{
        face: number;
        faceIndex: number;
        state:
            | "unknown"
            | "handling"
            | "rolling"
            | "crooked"
            | "rolled"
            | "onFace";
    }>, "face">;
    rssi: number;
    telemetry: Telemetry;
    temperature: {
        batteryTemperature: number;
        mcuTemperature: number;
    };
}

Properties

battery: Readonly<{
    isCharging: boolean;
    level: number;
}>

Updates with the battery level and charging status.

roll: Readonly<{
    face: number;
    faceIndex: number;
    state:
        | "unknown"
        | "handling"
        | "rolling"
        | "crooked"
        | "rolled"
        | "onFace";
}>

Updates with the roll state and face on any roll event but not more often than specified by the refresh interval argument, except when there is a roll result (i.e. state === 'onFace') in which case it updates immediately.

Type declaration

  • face: number

    The value of the die face that is currently facing up.

    Fudge die will return -1, 0 or 1.

  • faceIndex: number

    The 0-based index of the die face that is currently facing up.

    PixelInfo.currentFaceIndex for more details.

  • state:
        | "unknown"
        | "handling"
        | "rolling"
        | "crooked"
        | "rolled"
        | "onFace"

    The roll state of the Pixels die when this event was raised.

No value is returned until a roll event occurs.

rollFace: Pick<Readonly<{
    face: number;
    faceIndex: number;
    state:
        | "unknown"
        | "handling"
        | "rolling"
        | "crooked"
        | "rolled"
        | "onFace";
}>, "face">

Updates with the result of a roll.

  • The value is an object with the face number rather than just a number so rolling the same face will trigger a state change nonetheless.
  • No value is returned until a roll is made.
rssi: number

Updates with the received signal strength indicator (RSSI) in dBm.

telemetry: Telemetry

Updates with the telemetry data.

temperature: {
    batteryTemperature: number;
    mcuTemperature: number;
}

Updates with the temperature in Celsius.