@donovandb/capacitor-magnetometer
v0.0.8
Published
Custom Capacitor plugin to access the device's magnetometer sensor data for building compass applications on iOS and Android.
Readme
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 syncAPI
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<PluginListenerHandle>| Param | Type |
| ------------------ | -------------------------------------------------------------------------------- |
| eventName | 'magnetometerData' |
| listenerFunc | (data: MagnetometerData) => void |
Returns: Promise<PluginListenerHandle>
Interfaces
PluginListenerHandle
| Prop | Type |
| ------------ | ----------------------------------------- |
| remove | () => Promise<void> |
MagnetometerData
| Prop | Type |
| ------- | ------------------- |
| x | number |
| y | number |
| z | number |
