onDeviceMotionChange

Requires:
BaseKit≥2.3.2@ray-js/ray≥0.3.23
Platforms:
iOSAndroid
import { onDeviceMotionChange } from '@ray-js/ray';

// Promise usage
try {
  const res = await onDeviceMotionChange({ ...params });
  console.log(res);
} catch (err) {
  console.log(err.errorMsg);
}

Method signature
onDeviceMotionChange(listener: )

Description

Listen for device orientation changes (data is returned by the system; accuracy may differ between iOS and Android)

Parameters

ParameterTypeRequiredDescription
(params: ) => voidYes

Return Value

None

Examples

import { startDeviceMotionListening, onDeviceMotionChange } from '@ray-js/ray'

// Device motion events require enabling listening first; start then register.
startDeviceMotionListening({ interval: "normal" });

onDeviceMotionChange(e => {
  console.log(e);
});