Use AngularJS promise if available

This commit is contained in:
Ibby Hadeed
2017-12-29 10:15:44 -05:00
parent fc9dcc8e64
commit 0cc1a2b2ff
8 changed files with 64 additions and 49 deletions
+2 -2
View File
@@ -1,5 +1,5 @@
import { Injectable } from '@angular/core';
import { Cordova, CordovaCheck, IonicNativePlugin, Plugin } from '@ionic-native/core';
import { Cordova, CordovaCheck, IonicNativePlugin, Plugin, getPromise } from '@ionic-native/core';
export interface PrintOptions {
/**
@@ -90,7 +90,7 @@ export class Printer extends IonicNativePlugin {
*/
@CordovaCheck()
check(): Promise<any> {
return new Promise<any>((resolve: Function) => {
return getPromise<any>((resolve: Function) => {
Printer.getPlugin()
.check((avail: boolean, count: any) => {
resolve({ avail, count });