UNPKG

ionic-native

Version:

Native plugin wrappers for Cordova and Ionic with TypeScript, ES6+, Promise and Observable support

52 lines (51 loc) 1.59 kB
import { Observable } from 'rxjs/Observable'; /** * @name DB Meter * @description This plugin defines a global DBMeter object, which permits to get the decibel values from the microphone. * @usage * ```typescript * import { DBMeter } from 'ionic-native'; * * * // Start listening * let subscription = DBMeter.start().subscribe( * data => console.log(data) * ); * * // Check if we are listening * DBMeter.isListening().then( * (isListening: boolean) => console.log(isListening) * ); * * // Stop listening * subscription.unsubscribe(); * * // Delete DBMeter instance from memory * DBMeter.delete().then( * () => console.log('Deleted DB Meter instance'), * error => console.log('Error occurred while deleting DB Meter instance') * ); * ``` */ export declare class DBMeter { /** * Starts listening * @returns {Observable<any>} Returns an observable. Subscribe to start listening. Unsubscribe to stop listening. */ static start(): Observable<any>; /** * Stops listening * @private */ static stop(): Promise<any>; /** * Check if the DB Meter is listening * @returns {Promise<boolean>} Returns a promise that resolves with a boolean that tells us whether the DB meter is listening */ static isListening(): Promise<boolean>; /** * Delete the DB Meter instance * @returns {Promise<any>} Returns a promise that will resolve if the instance has been deleted, and rejects if errors occur. */ static delete(): Promise<any>; }