1 | "use strict";
|
2 | var __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 | };
|
8 | var plugin_1 = require('./plugin');
|
9 | var Observable_1 = require('rxjs/Observable');
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 |
|
27 |
|
28 |
|
29 |
|
30 | var InAppBrowser = (function () {
|
31 | function InAppBrowser(url, target, options) {
|
32 | try {
|
33 | if (options && typeof options !== 'string')
|
34 | options = Object.keys(options).map(function (key) { return (key + "=" + options[key]); }).join(',');
|
35 | this._objectInstance = cordova.InAppBrowser.open(url, target, options);
|
36 | }
|
37 | catch (e) {
|
38 | window.open(url);
|
39 | console.warn('Native: InAppBrowser is not installed or you are running on a browser. Falling back to window.open, all instance methods will NOT work.');
|
40 | }
|
41 | }
|
42 | |
43 |
|
44 |
|
45 |
|
46 | InAppBrowser.prototype.show = function () { };
|
47 | |
48 |
|
49 |
|
50 | InAppBrowser.prototype.close = function () { };
|
51 | |
52 |
|
53 |
|
54 |
|
55 | InAppBrowser.prototype.hide = function () { };
|
56 | |
57 |
|
58 |
|
59 |
|
60 |
|
61 | InAppBrowser.prototype.executeScript = function (script) { return; };
|
62 | |
63 |
|
64 |
|
65 |
|
66 |
|
67 | InAppBrowser.prototype.insertCSS = function (css) { return; };
|
68 | |
69 |
|
70 |
|
71 |
|
72 |
|
73 | InAppBrowser.prototype.on = function (event) {
|
74 | var _this = this;
|
75 | return new Observable_1.Observable(function (observer) {
|
76 | _this._objectInstance.addEventListener(event, observer.next.bind(observer));
|
77 | return function () { return _this._objectInstance.removeEventListener(event, observer.next.bind(observer)); };
|
78 | });
|
79 | };
|
80 | __decorate([
|
81 | plugin_1.CordovaInstance({ sync: true })
|
82 | ], InAppBrowser.prototype, "show", null);
|
83 | __decorate([
|
84 | plugin_1.CordovaInstance({ sync: true })
|
85 | ], InAppBrowser.prototype, "close", null);
|
86 | __decorate([
|
87 | plugin_1.CordovaInstance({ sync: true })
|
88 | ], InAppBrowser.prototype, "hide", null);
|
89 | __decorate([
|
90 | plugin_1.CordovaInstance()
|
91 | ], InAppBrowser.prototype, "executeScript", null);
|
92 | __decorate([
|
93 | plugin_1.CordovaInstance()
|
94 | ], InAppBrowser.prototype, "insertCSS", null);
|
95 | InAppBrowser = __decorate([
|
96 | plugin_1.Plugin({
|
97 | pluginName: 'InAppBrowser',
|
98 | plugin: 'cordova-plugin-inappbrowser',
|
99 | pluginRef: 'cordova.InAppBrowser',
|
100 | repo: 'https://github.com/apache/cordova-plugin-inappbrowser'
|
101 | })
|
102 | ], InAppBrowser);
|
103 | return InAppBrowser;
|
104 | }());
|
105 | exports.InAppBrowser = InAppBrowser;
|
106 |
|
\ | No newline at end of file |