docs(db-meter): refactored example

This commit is contained in:
Daniel Sogl 2018-03-16 15:00:45 +01:00 committed by GitHub
parent f11be24f74
commit 03c219936c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,5 +1,5 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { Cordova, Plugin, IonicNativePlugin } from '@ionic-native/core'; import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core';
import { Observable } from 'rxjs/Observable'; import { Observable } from 'rxjs/Observable';
/** /**
@ -21,7 +21,7 @@ import { Observable } from 'rxjs/Observable';
* *
* // Check if we are listening * // Check if we are listening
* this.dbMeter.isListening().then( * this.dbMeter.isListening().then(
* (isListening: boolean) => console.log(isListening) * isListening => console.log(isListening)
* ); * );
* *
* // Stop listening * // Stop listening
@ -43,7 +43,6 @@ import { Observable } from 'rxjs/Observable';
}) })
@Injectable() @Injectable()
export class DBMeter extends IonicNativePlugin { export class DBMeter extends IonicNativePlugin {
/** /**
* Starts listening * Starts listening
* @returns {Observable<any>} Returns an observable. Subscribe to start listening. Unsubscribe to stop listening. * @returns {Observable<any>} Returns an observable. Subscribe to start listening. Unsubscribe to stop listening.
@ -52,27 +51,34 @@ export class DBMeter extends IonicNativePlugin {
observable: true, observable: true,
clearFunction: 'stop' clearFunction: 'stop'
}) })
start(): Observable<any> { return; } start(): Observable<any> {
return;
}
/** /**
* Stops listening * Stops listening
* @hidden * @hidden
*/ */
@Cordova() @Cordova()
stop(): Promise<any> { return; } stop(): Promise<any> {
return;
}
/** /**
* Check if the DB Meter is listening * 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 * @returns {Promise<boolean>} Returns a promise that resolves with a boolean that tells us whether the DB meter is listening
*/ */
@Cordova() @Cordova()
isListening(): Promise<boolean> { return; } isListening(): Promise<boolean> {
return;
}
/** /**
* Delete the DB Meter instance * 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. * @returns {Promise<any>} Returns a promise that will resolve if the instance has been deleted, and rejects if errors occur.
*/ */
@Cordova() @Cordova()
delete(): Promise<any> { return; } delete(): Promise<any> {
return;
}
} }