在Ionic 4和Angular 8项目中,此错误在运行时出现在@ ionic-native / In-app-browser-> index.js文件中,任何人都可以指导我解决此错误。 在这里我提到了文件app.module.js和Index.js。即使我尝试再次npm install无法解决它,我也无法理解为什么会出现此错误。
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,desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target,r) : d(target,key)) || r;
return c > 3 && r && Object.defineProperty(target,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,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,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 }),"close","hide",null);
__decorate([
CordovaInstance(),[Object]),Promise)
],"executeScript","insertCSS",null);
__decorate([
InstanceCheck(),[String]),Observable)
],"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,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,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,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,and each feature's
* name/value pairs must be separated by a comma. Feature names are case insensitive.
* @returns {InAppBrowserObject}
*/
function (url,options) {
return new InAppBrowserObject(url,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