@kevinmarques/capacitor-barometer
v0.1.0
Published
A Capacitor plugin that allows you to access barometric pressure data from the device's sensors. This plugin provides real-time updates on atmospheric pressure and enables your app to make weather predictions, track altitude changes, or create pressure-ba
Downloads
63
Maintainers
Readme
capacitor-barometer
A Capacitor plugin that allows you to access barometric pressure data from the device's sensors. This plugin provides real-time updates on atmospheric pressure and enables your app to make weather predictions, track altitude changes, or create pressure-based triggers.
Install
npm install capacitor-barometer
npx cap sync
API
isAvailable()
isAvailable() => Promise<{ available: boolean; }>
Checks if the barometer sensor is available.
Returns: Promise<{ available: boolean; }>
Since: 0.1.0
getPressure()
getPressure() => Promise<{ pressure: number; }>
Gets the current pressure.
Returns: Promise<{ pressure: number; }>
Since: 0.1.0
addListener('onPressureChange', ...)
addListener(eventName: 'onPressureChange', listenerFunc: (event: PressureChangeEvent) => void) => Promise<PluginListenerHandle> & PluginListenerHandle
Adds a listener for the pressure change event. This event is emitted whenever the barometric pressure changes.
| Param | Type | Description |
| ------------------ | --------------------------------------------------------------------------------------- | --------------------------------------------------------- |
| eventName
| 'onPressureChange' | - Name of the event to listen for ("onPressureChange"
). |
| listenerFunc
| (event: PressureChangeEvent) => void | - Callback function that receives the pressure data. |
Returns: Promise<PluginListenerHandle> & PluginListenerHandle
Interfaces
PluginListenerHandle
| Prop | Type |
| ------------ | ----------------------------------------- |
| remove
| () => Promise<void> |
PressureChangeEvent
| Prop | Type |
| -------------- | ------------------- |
| pressure
| number |