ionic-native
Version:
Native plugin wrappers for Cordova and Ionic with TypeScript, ES6+, Promise and Observable support
58 lines • 2.31 kB
JavaScript
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
import { Cordova, Plugin } from './plugin';
/**
* @name App Availability
* @description
* This plugin allows you to check if an app is installed on the user's device. It requires an URI Scheme (e.g. twitter://) on iOS or a Package Name (e.g com.twitter.android) on Android.
*
* Requires Cordova plugin: cordova-plugin-appavailability. For more info, please see the [AppAvailability plugin docs](https://github.com/ohh2ahh/AppAvailability).
*
* @usage
* ```typescript
* import { AppAvailability, Device } from 'ionic-native';
*
*
* let app;
*
* if (Device.platform === 'iOS') {
* app = 'twitter://';
* } else if (Device.platform === 'Android') {
* app = 'com.twitter.android';
* }
*
* AppAvailability.check(app)
* .then(
* (yes: string) => console.log(app + ' is available'),
* (no: string) => console.log(app + ' is NOT available')
* );
* ```
*/
export var AppAvailability = (function () {
function AppAvailability() {
}
/**
* Checks if an app is available on device
* @param {string} app Package name on android, or URI scheme on iOS
* @returns {Promise<boolean>}
*/
AppAvailability.check = function (app) { return; };
__decorate([
Cordova()
], AppAvailability, "check", null);
AppAvailability = __decorate([
Plugin({
pluginName: 'AppAvailability',
plugin: 'cordova-plugin-appavailability',
pluginRef: 'appAvailability',
repo: 'https://github.com/ohh2ahh/AppAvailability',
platforms: ['Android', 'iOS']
})
], AppAvailability);
return AppAvailability;
}());
//# sourceMappingURL=appavailability.js.map