import { Component , AfterViewInit , OnDestroy , Output , EventEmitter } from '@angular/core' ; import { TranslateService } from '@ngx-translate/core' ; import { GameService } from '../../../../../../core/game.service' ; import { GlobalSettingService , Account } from '../../../../../../global/globalSetting.service' ; import { GlobalStatusService } from '../../../../../../global/globalStatus.service' ; import { ElMessageService } from 'element-angular' ; import * as Rx from 'rxjs' ; import { WebviewTag , WebContents } from 'electron' ; import { ElectronService } from '../../../../../../core/electron.service' ; import { PluginService , Plugin } from '../../../../../../core/plugin.service' ; @ Component ( { selector : 'app-uiframe-statusbar-toolbar-plugin' , templateUrl : './plugin.component.html' , styleUrls : [ './plugin.component.scss' ] } ) export class UIFrameStatusBarToolBarPluginComponent implements AfterViewInit , OnDestroy { private subscriptionList : Rx . Subscription [ ] = [ ] ; public list : Plugin [ ] = [ ] ; @ Output ( ) onSelected = new EventEmitter ( ) ; constructor ( private gameService , private globalSettingService , private globalStatusService , private message , private translateService , private electronService , private pluginService ) { this . list = pluginService . PluginList ; this . subscriptionList . push ( pluginService . ListUpdate . subscribe ( v => { this . list = pluginService . PluginList ; } ) ) ; } pluginSelect ( index ) { this . pluginService . ActivePlugin ( this . list [ index ] ) ; this . onSelected . emit ( ) ; } ngAfterViewInit ( ) { } ngOnDestroy ( ) { for ( let i = 0 ; i < this . subscriptionList . length ; i ++ ) { this . subscriptionList [ i ] . unsubscribe ( ) ; } } }