Skip to content
0

katanakit-js / useOnDeviceOrientation

Function: useOnDeviceOrientation() ​

ts
function useOnDeviceOrientation(callback): (() => void) | null;

Defined in: src/infrastructure/sensors/sensors.service.ts:229

Listens for device orientation events (compass heading, tilt).

Parameters ​

ParameterTypeDescription
callback(event) => voidCalled with each DeviceOrientationEvent.

Returns ​

(() => void) | null

A cleanup function that removes the listener, or null if unavailable.

Example ​

ts
const off = useOnDeviceOrientation((e) => {
  console.log("Alpha:", e.alpha);
});

Released under the MIT License.