Custom Capacitor plugin to access the device's magnetometer sensor data for building compass applications on iOS and Android.
npm install @donovandb/capacitor-magnetometerbash
npm install capacitor-magnetometer
npx cap sync
`
API
echo(...)
* startMagnetometerUpdates(...)
* stopMagnetometerUpdates()
* addListener('magnetometerData', ...)
* Interfaces
$3
`typescript
echo(options: { value: string; }) => Promise<{ value: string; }>
`| Param | Type |
| ------------- | ------------------------------- |
|
options | { value: string; } |Returns: Promise<{ value: string; }>
--------------------
$3
`typescript
startMagnetometerUpdates(options: { frequency: number; }) => Promise
`| Param | Type |
| ------------- | ----------------------------------- |
|
options | { frequency: number; } |--------------------
$3
`typescript
stopMagnetometerUpdates() => Promise
`--------------------
$3
`typescript
addListener(eventName: 'magnetometerData', listenerFunc: (data: MagnetometerData) => void) => Promise
`| Param | Type |
| ------------------ | -------------------------------------------------------------------------------- |
|
eventName | 'magnetometerData' |
| listenerFunc | (data: MagnetometerData) => void |Returns: Promise<PluginListenerHandle>
--------------------
$3
#### PluginListenerHandle
| Prop | Type |
| ------------ | ----------------------------------------- |
|
remove | () => Promise<void> |
#### MagnetometerData
| Prop | Type |
| ------- | ------------------- |
|
x | number |
| y | number |
| z` | number |