import angular from 'angular' ; import { NgModule } from 'angular-ts-decorators' ; import browser from 'webextension-polyfill' ; import { ExceptionHandlerService } from '../../shared/errors/exception-handler/exception-handler.service' ; import { GlobalSharedModule } from '../../shared/global-shared.module' ; import { WebExtSharedModule } from '../shared/webext-shared.module' ; import { WebExtBackgroundComponent } from './webext-background.component' ; import { WebExtBackgroundService } from './webext-background.service' ; @ NgModule ( { declarations : [ WebExtBackgroundComponent ] , id : 'WebExtBackgroundModule' , imports : [ GlobalSharedModule , WebExtSharedModule ] , providers : [ WebExtBackgroundService ] } ) export class WebExtBackgroundModule { } ( WebExtBackgroundModule as NgModule ) . module . config ( [ '$compileProvider' , '$httpProvider' , ( $compileProvider , $httpProvider ) => { $compileProvider . debugInfoEnabled ( false ) ; $httpProvider . interceptors . push ( 'ApiRequestInterceptorFactory' ) ; } ] ) . factory ( '$exceptionHandler' , [ '$injector' , 'AlertService' , 'LogService' , ExceptionHandlerService . Factory ] ) ; browser . runtime . onInstalled . addListener ( ( details ) => { const element = document . querySelector ( '#install' ) ; angular . element ( element ) . data ( 'details' , details ) ; ( document . querySelector ( '#install' ) as HTMLButtonElement ) . click ( ) ; } ) ; browser . runtime . onStartup . addListener ( ( ) => { ( document . querySelector ( '#startup' ) as HTMLButtonElement ) . click ( ) ; } ) ;