GamepadService

Provides access to the Gamepad API for reading game controller input. Supports connection events, polling for button/axis state, and listing connected gamepads.

API Variant
TypeScriptexample.ts
import { GamepadService } from '@angular-helpers/browser-web-apis'

# Methods

MethodSignatureReturnsDescription
getSnapshotgetSnapshot(index: number): GamepadState | nullGamepadState | nullPublic method getSnapshot.
getConnectedGamepadsgetConnectedGamepads(): GamepadState[]GamepadState[]Public method getConnectedGamepads.
watchConnectionswatchConnections(): Observable<{ gamepad: GamepadState; type: 'connected' | 'disconnected' }>Observable<{ gamepad: GamepadState; type: 'connected' | 'disconnected' }>Public method watchConnections.
pollpoll(index: number, intervalMs: any): Observable<GamepadState>Observable<GamepadState>Public method poll.
LCP N/A
CLS N/A
INP N/A