UNPKG

2.89 kBJavaScriptView Raw
1"use strict";
2var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5 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;
6 return c > 3 && r && Object.defineProperty(target, key, r), r;
7};
8var plugin_1 = require('./plugin');
9/**
10 * @name Push
11 * @description
12 * Register and receive push notifications.
13 *
14 * Requires Cordova plugin: `phonegap-plugin-push`. For more info, please see the [Push plugin docs](https://github.com/phonegap/phonegap-plugin-push).
15 *
16 * For TypeScript users, see the [Push plugin docs about using TypeScript for custom notifications](https://github.com/phonegap/phonegap-plugin-push/blob/master/docs/TYPESCRIPT.md).
17 *
18 * @usage
19 * ```typescript
20 * import { Push } from 'ionic-native';
21 * ```
22 */
23var Push = (function () {
24 function Push() {
25 }
26 /**
27 * Initialize the plugin on the native side.
28 *
29 * ```
30 * var push = Push.init({
31 * android: {
32 * senderID: '12345679'
33 * },
34 * ios: {
35 * alert: 'true',
36 * badge: true,
37 * sound: 'false'
38 * },
39 * windows: {}
40 * });
41 * ```
42 *
43 * @param {PushOptions} options The Push [options](https://github.com/phonegap/phonegap-plugin-push/blob/master/docs/API.md#parameters).
44 * @returns {PushNotification} Returns a new [PushNotification](https://github.com/phonegap/phonegap-plugin-push/blob/master/docs/API.md#pushonevent-callback) object.
45 */
46 Push.init = function (options) { return; };
47 /**
48 * Check whether the push notification permission has been granted.
49 * @return {Promise<{isEnabled: boolean}>} Returns a Promise that resolves with an object with one property: isEnabled, a boolean that indicates if permission has been granted.
50 */
51 Push.hasPermission = function () { return; };
52 __decorate([
53 plugin_1.Cordova({
54 sync: true
55 })
56 ], Push, "init", null);
57 __decorate([
58 plugin_1.Cordova()
59 ], Push, "hasPermission", null);
60 Push = __decorate([
61 plugin_1.Plugin({
62 pluginName: 'Push',
63 plugin: 'phonegap-plugin-push',
64 pluginRef: 'PushNotification',
65 repo: 'https://github.com/phonegap/phonegap-plugin-push',
66 install: 'ionic plugin add phonegap-plugin-push --variable SENDER_ID=XXXXXXXXX'
67 })
68 ], Push);
69 return Push;
70}());
71exports.Push = Push;
72//# sourceMappingURL=push.js.map
\No newline at end of file