mirror of
https://github.com/danielsogl/awesome-cordova-plugins.git
synced 2026-04-13 00:00:10 +08:00
Use AngularJS promise if available
This commit is contained in:
@@ -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 });
|
||||
|
||||
Reference in New Issue
Block a user