0.0.7 • Published 1 year ago
capacitor-magnetometer v0.0.7
capacitor-magnetometer
Custom Capacitor plugin to access the device's magnetometer sensor data for building compass applications on iOS and Android.
Install
npm install capacitor-magnetometer
npx cap sync
API
echo(...)
startMagnetometerUpdates(...)
stopMagnetometerUpdates()
addListener('magnetometerData', ...)
- Interfaces
echo(...)
echo(options: { value: string; }) => Promise<{ value: string; }>
Param | Type |
---|---|
options | { value: string; } |
Returns: Promise<{ value: string; }>
startMagnetometerUpdates(...)
startMagnetometerUpdates(options: { frequency: number; }) => Promise<void>
Param | Type |
---|---|
options | { frequency: number; } |
stopMagnetometerUpdates()
stopMagnetometerUpdates() => Promise<void>
addListener('magnetometerData', ...)
addListener(eventName: 'magnetometerData', listenerFunc: (data: MagnetometerData) => void) => Promise<{ remove: () => void; }>
Param | Type |
---|---|
eventName | 'magnetometerData' |
listenerFunc | (data: MagnetometerData) => void |
Returns: Promise<{ remove: () => void; }>
Interfaces
MagnetometerData
Prop | Type |
---|---|
x | number |
y | number |
z | number |