refactor(three-dee-touch): use CordovaFunctionOverride decorator (#2028)

This commit is contained in:
Niklas Merz 2017-12-08 20:58:53 +01:00 committed by Ibby Hadeed
parent 9a5211001f
commit 7c2a761078

View File

@ -1,10 +1,7 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { Cordova, Plugin, IonicNativePlugin } from '@ionic-native/core'; import { Cordova, CordovaFunctionOverride, Plugin, IonicNativePlugin } from '@ionic-native/core';
import { Observable } from 'rxjs/Observable'; import { Observable } from 'rxjs/Observable';
declare var window: any;
export interface ThreeDeeTouchQuickAction { export interface ThreeDeeTouchQuickAction {
/** /**
@ -165,16 +162,8 @@ export class ThreeDeeTouch extends IonicNativePlugin {
* When a home icon is pressed, your app launches and this JS callback is invoked. * When a home icon is pressed, your app launches and this JS callback is invoked.
* @returns {Observable<any>} returns an observable that notifies you when he user presses on the home screen icon * @returns {Observable<any>} returns an observable that notifies you when he user presses on the home screen icon
*/ */
onHomeIconPressed(): Observable<any> { @CordovaFunctionOverride()
return new Observable(observer => { onHomeIconPressed(): Observable<any> { return; }
if (window.ThreeDeeTouch) {
window.ThreeDeeTouch.onHomeIconPressed = observer.next.bind(observer);
} else {
observer.error('3dTouch plugin is not available.');
observer.complete();
}
});
}
/** /**
* Enable Link Preview. * Enable Link Preview.