What is the best way to access WebXR controller gamepad state

I am developing a webxr app targeted at the Oculus Quest so I would like to be able to access all gamepad and sensor state as they will be known to the app and supported features. Currently I have created an observer class where I poll the gamepad every render frame and manage my own event listeners and dispatching. This will work but seems less then ideal to have multiple systems accessing controller state the subsequent events.

Is there a better way I should go about this?

Also, can anyone give advice on how to access accelerometer data for each controller?

1 Like