Resolves the target window via resolveWindowSource (honoring
options.window for iframe / custom root scenarios), exposes acceleration,
rotation rate, and interval as observables, and integrates with the
iOS permission flow via createPermissionAware.
Whether the device has real motion sensor hardware. isSupported only checks API availability — desktop browsers expose the API but may fire events with non-zero interval yet all-null values when no hardware exists. hasRealData$ becomes true on the first event where interval > 0 AND at least one of acceleration or rotationRate has a non-null value.
acceleration$
ReadonlyObservable<{ x: number | null; y: number | null; z: number | null; }>
Linear acceleration of the device (without gravity), in m/s²
accelerationIncludingGravity$
ReadonlyObservable<{ x: number | null; y: number | null; z: number | null; }>
Linear acceleration of the device (including gravity), in m/s²
rotationRate$
ReadonlyObservable<{ alpha: number | null; beta: number | null; gamma: number | null; }>
Rate of rotation of the device around each axis, in deg/s
interval$
ReadonlyObservable<number>
Interval (in ms) at which the device obtains motion data
isSupported$
ReadonlyObservable<boolean>
-
permissionState$
ReadonlyObservable<PermissionState>
Current permission state. "unsupported" = API not available in this environment. Never undefined.
permissionGranted$
ReadonlyObservable<boolean>
true only when permissionState$ is "granted"
needsPermission$
ReadonlyObservable<boolean>
true when permissionState$ is "prompt" or "denied". "unsupported" → false.
ensurePermission
() => Promise<void>
Request permission. No-op if unsupported or already granted. If requestPermission throws, the error is propagated (state unchanged).