В проектах Ionic 4 и Angular 8 эта ошибка возникает во время выполнения в файле @ ionic-native / In-app-browser-> index.js, и любой может помочь мне решить эту ошибку. Здесь я упомянул файл app.module.js, а также Index.js. Я не могу понять, почему возникает эта ошибка, даже если я попытался снова установить npm, не могу ее устранить.
App.module.js
import { BrowserModule } from '@angular/platform-browser';
import { RouteReuseStrategy, RouterModule } from '@angular/router';
import { TranslateLoader, TranslateModule } from '@ngx-translate/core';
import { TranslateHttpLoader } from '@ngx-translate/http-loader';
import { IonicModule, IonicRouteStrategy } from '@ionic/angular';
import { SplashScreen } from '@ionic-native/splash-screen/ngx';
import { StatusBar } from '@ionic-native/status-bar/ngx';
import { AppComponent } from './app.component';
import { AppRoutingModule } from './app-routing.module';
import { LayoutComponent } from './components/layout/layout.component';
import { HttpClient, HttpClientModule } from '@angular/common/http';
import { AngularFireModule } from '@angular/fire';
import { AngularFirestoreModule } from '@angular/fire/firestore';
import { Firebase } from "@ionic-native/firebase/ngx";
import { UniqueDeviceID } from '@ionic-native/unique-device-id/ngx';
import { Device } from '@ionic-native/device/ngx';
import { TwitterConnect } from '@ionic-native/twitter-connect/ngx';
import { Facebook } from '@ionic-native/facebook/ngx';
import { WelcomePage } from './pages/welcome/welcome.page';
import { CommonModule } from '@angular/common';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { InAppBrowser } from '@ionic-native/in-app-browser';
export const firebaseConfig = {
apiKey: "AIzaSyDDVrXtXhTO60cYivkRwaU5XoM0CnrMyOI",
authDomain: "metricool-cc74e.firebaseapp.com",
databaseURL: "https://metricool-cc74e.firebaseio.com",
projectId: "metricool-cc74e",
storageBucket: "metricool-cc74e.appspot.com",
messagingSenderId: "352613795929"
};
@NgModule({
declarations: [
AppComponent,
LayoutComponent,
WelcomePage
],
entryComponents: [],
imports: [
CommonModule,
FormsModule,
ReactiveFormsModule,
BrowserModule,
HttpClientModule,
AngularFireModule.initializeApp(firebaseConfig),
AngularFirestoreModule,
TranslateModule.forRoot({
loader: {
provide: TranslateLoader,
useFactory: createTranslateLoader,
deps: [HttpClient]
}
}),
IonicModule.forRoot(),
AppRoutingModule,
],
providers: [
StatusBar,
SplashScreen,
Firebase,
UniqueDeviceID,
Device,
TwitterConnect,
Facebook,
InAppBrowser,
{ provide: RouteReuseStrategy, useClass: IonicRouteStrategy },
],
bootstrap: [AppComponent]
})
export class AppModule { }
export function createTranslateLoader(http: HttpClient) {
return new TranslateHttpLoader(http);
}
Index.js
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
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;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
import { Injectable } from '@angular/core';
import { CordovaInstance, InstanceCheck, IonicNativePlugin, Plugin } from '@ionic-native/core';
import { Observable } from 'rxjs/Observable';
/**
* @hidden
*/
var InAppBrowserObject = (function () {
/**
* Opens a URL in a new InAppBrowser instance, the current browser instance, or the system browser.
* @param {string} url The URL to load.
* @param {string} [target="self"] The target in which to load the URL, an optional parameter that defaults to _self.
* _self: Opens in the WebView if the URL is in the white list, otherwise it opens in the InAppBrowser.
* _blank: Opens in the InAppBrowser.
* _system: Opens in the system's web browser.
* @param {string | InAppBrowserOptions} [options] Options for the InAppBrowser. Optional, defaulting to: location=yes.
* The options string must not contain any blank space, and each feature's
* name/value pairs must be separated by a comma. Feature names are case insensitive.
*/
function InAppBrowserObject(url, target, options) {
try {
if (options && typeof options !== 'string') {
options = Object.keys(options)
.map(function (key) { return key + "=" + options[key]; })
.join(',');
}
this._objectInstance = cordova.InAppBrowser.open(url, target, options);
}
catch (e) {
window.open(url, target);
console.warn('Native: InAppBrowser is not installed or you are running on a browser. Falling back to window.open.');
}
}
/**
* Displays an InAppBrowser window that was opened hidden. Calling this has no effect
* if the InAppBrowser was already visible.
*/
/**
* Displays an InAppBrowser window that was opened hidden. Calling this has no effect
* if the InAppBrowser was already visible.
*/
InAppBrowserObject.prototype.show = /**
* Displays an InAppBrowser window that was opened hidden. Calling this has no effect
* if the InAppBrowser was already visible.
*/
function () { };
/**
* Closes the InAppBrowser window.
*/
/**
* Closes the InAppBrowser window.
*/
InAppBrowserObject.prototype.close = /**
* Closes the InAppBrowser window.
*/
function () { };
/**
* Hides an InAppBrowser window that is currently shown. Calling this has no effect
* if the InAppBrowser was already hidden.
*/
/**
* Hides an InAppBrowser window that is currently shown. Calling this has no effect
* if the InAppBrowser was already hidden.
*/
InAppBrowserObject.prototype.hide = /**
* Hides an InAppBrowser window that is currently shown. Calling this has no effect
* if the InAppBrowser was already hidden.
*/
function () { };
/**
* Injects JavaScript code into the InAppBrowser window.
* @param script {Object} Details of the script to run, specifying either a file or code key.
* @returns {Promise<any>}
*/
/**
* Injects JavaScript code into the InAppBrowser window.
* @param script {Object} Details of the script to run, specifying either a file or code key.
* @returns {Promise<any>}
*/
InAppBrowserObject.prototype.executeScript = /**
* Injects JavaScript code into the InAppBrowser window.
* @param script {Object} Details of the script to run, specifying either a file or code key.
* @returns {Promise<any>}
*/
function (script) {
return;
};
/**
* Injects CSS into the InAppBrowser window.
* @param css {Object} Details of the script to run, specifying either a file or code key.
* @returns {Promise<any>}
*/
/**
* Injects CSS into the InAppBrowser window.
* @param css {Object} Details of the script to run, specifying either a file or code key.
* @returns {Promise<any>}
*/
InAppBrowserObject.prototype.insertCSS = /**
* Injects CSS into the InAppBrowser window.
* @param css {Object} Details of the script to run, specifying either a file or code key.
* @returns {Promise<any>}
*/
function (css) {
return;
};
/**
* A method that allows you to listen to events happening in the browser.
* @param event {string} Name of the event
* @returns {Observable<InAppBrowserEvent>} Returns back an observable that will listen to the event on subscribe, and will stop listening to the event on unsubscribe.
*/
/**
* A method that allows you to listen to events happening in the browser.
* @param event {string} Name of the event
* @returns {Observable<InAppBrowserEvent>} Returns back an observable that will listen to the event on subscribe, and will stop listening to the event on unsubscribe.
*/
InAppBrowserObject.prototype.on = /**
* A method that allows you to listen to events happening in the browser.
* @param event {string} Name of the event
* @returns {Observable<InAppBrowserEvent>} Returns back an observable that will listen to the event on subscribe, and will stop listening to the event on unsubscribe.
*/
function (event) {
var _this = this;
return new Observable(function (observer) {
_this._objectInstance.addEventListener(event, observer.next.bind(observer));
return function () {
return _this._objectInstance.removeEventListener(event, observer.next.bind(observer));
};
});
};
__decorate([
CordovaInstance({ sync: true }),
__metadata("design:type", Function),
__metadata("design:paramtypes", []),
__metadata("design:returntype", void 0)
], InAppBrowserObject.prototype, "show", null);
__decorate([
CordovaInstance({ sync: true }),
__metadata("design:type", Function),
__metadata("design:paramtypes", []),
__metadata("design:returntype", void 0)
], InAppBrowserObject.prototype, "close", null);
__decorate([
CordovaInstance({ sync: true }),
__metadata("design:type", Function),
__metadata("design:paramtypes", []),
__metadata("design:returntype", void 0)
], InAppBrowserObject.prototype, "hide", null);
__decorate([
CordovaInstance(),
__metadata("design:type", Function),
__metadata("design:paramtypes", [Object]),
__metadata("design:returntype", Promise)
], InAppBrowserObject.prototype, "executeScript", null);
__decorate([
CordovaInstance(),
__metadata("design:type", Function),
__metadata("design:paramtypes", [Object]),
__metadata("design:returntype", Promise)
], InAppBrowserObject.prototype, "insertCSS", null);
__decorate([
InstanceCheck(),
__metadata("design:type", Function),
__metadata("design:paramtypes", [String]),
__metadata("design:returntype", Observable)
], InAppBrowserObject.prototype, "on", null);
return InAppBrowserObject;
}());
export { InAppBrowserObject };
/**
* @name In App Browser
* @description Launches in app Browser
* @usage
* ```typescript
* import { InAppBrowser } from '@ionic-native/in-app-browser';
*
* constructor(private iab: InAppBrowser) { }
*
*
* ...
*
*
* const browser = this.iab.create('https://ionicframework.com/');
*
* browser.executeScript(...);
*
* browser.insertCSS(...);
* browser.on('loadstop').subscribe(event => {
* browser.insertCSS({ code: "body{color: red;" });
* });
*
* browser.close();
*
* ```
* @classes
* InAppBrowserObject
* @interfaces
* InAppBrowserEvent
* InAppBrowserOptions
*/
var InAppBrowser = (function (_super) {
__extends(InAppBrowser, _super);
function InAppBrowser() {
return _super !== null && _super.apply(this, arguments) || this;
}
/**
* Opens a URL in a new InAppBrowser instance, the current browser instance, or the system browser.
* @param url {string} The URL to load.
* @param target {string} The target in which to load the URL, an optional parameter that defaults to _self.
* @param options {string} Options for the InAppBrowser. Optional, defaulting to: location=yes.
* The options string must not contain any blank space, and each feature's
* name/value pairs must be separated by a comma. Feature names are case insensitive.
* @returns {InAppBrowserObject}
*/
/**
* Opens a URL in a new InAppBrowser instance, the current browser instance, or the system browser.
* @param url {string} The URL to load.
* @param target {string} The target in which to load the URL, an optional parameter that defaults to _self.
* @param options {string} Options for the InAppBrowser. Optional, defaulting to: location=yes.
* The options string must not contain any blank space, and each feature's
* name/value pairs must be separated by a comma. Feature names are case insensitive.
* @returns {InAppBrowserObject}
*/
InAppBrowser.prototype.create = /**
* Opens a URL in a new InAppBrowser instance, the current browser instance, or the system browser.
* @param url {string} The URL to load.
* @param target {string} The target in which to load the URL, an optional parameter that defaults to _self.
* @param options {string} Options for the InAppBrowser. Optional, defaulting to: location=yes.
* The options string must not contain any blank space, and each feature's
* name/value pairs must be separated by a comma. Feature names are case insensitive.
* @returns {InAppBrowserObject}
*/
function (url, target, options) {
return new InAppBrowserObject(url, target, options);
};
InAppBrowser.decorators = [
{ type: Injectable },
];
/**
* @name In App Browser
* @description Launches in app Browser
* @usage
* ```typescript
* import { InAppBrowser } from '@ionic-native/in-app-browser';
*
* constructor(private iab: InAppBrowser) { }
*
*
* ...
*
*
* const browser = this.iab.create('https://ionicframework.com/');
*
* browser.executeScript(...);
*
* browser.insertCSS(...);
* browser.on('loadstop').subscribe(event => {
* browser.insertCSS({ code: "body{color: red;" });
* });
*
* browser.close();
*
* ```
* @classes
* InAppBrowserObject
* @interfaces
* InAppBrowserEvent
* InAppBrowserOptions
*/
InAppBrowser = __decorate([
Plugin({
pluginName: 'InAppBrowser',
plugin: 'cordova-plugin-inappbrowser',
pluginRef: 'cordova.InAppBrowser',
repo: 'https://github.com/apache/cordova-plugin-inappbrowser',
platforms: ['AmazonFire OS', 'Android', 'Browser', 'iOS', 'macOS', 'Windows']
})
], InAppBrowser);
return InAppBrowser;
}(IonicNativePlugin));
export { InAppBrowser };
//# sourceMappingURL=index.js.map