2020-03-29 23:59:04 +07:00
|
|
|
import { Component, OnInit } from '@angular/core';
|
2020-02-16 22:15:07 +07:00
|
|
|
import { WebsocketService } from 'src/app/services/websocket.service';
|
2020-02-17 00:26:57 +07:00
|
|
|
import { OptimizedMempoolStats } from '../../interfaces/node-api.interface';
|
2020-02-16 22:15:07 +07:00
|
|
|
import { StateService } from 'src/app/services/state.service';
|
|
|
|
import { ApiService } from 'src/app/services/api.service';
|
2020-03-24 00:52:08 +07:00
|
|
|
import { SeoService } from 'src/app/services/seo.service';
|
2019-07-27 18:43:17 +03:00
|
|
|
|
|
|
|
@Component({
|
|
|
|
selector: 'app-television',
|
|
|
|
templateUrl: './television.component.html',
|
|
|
|
styleUrls: ['./television.component.scss']
|
|
|
|
})
|
|
|
|
export class TelevisionComponent implements OnInit {
|
|
|
|
loading = true;
|
|
|
|
|
2020-02-17 00:26:57 +07:00
|
|
|
mempoolStats: OptimizedMempoolStats[] = [];
|
2019-07-27 18:43:17 +03:00
|
|
|
mempoolVsizeFeesData: any;
|
|
|
|
|
|
|
|
constructor(
|
2020-02-16 22:15:07 +07:00
|
|
|
private websocketService: WebsocketService,
|
|
|
|
private apiService: ApiService,
|
|
|
|
private stateService: StateService,
|
2020-03-24 00:52:08 +07:00
|
|
|
private seoService: SeoService,
|
2019-07-27 18:43:17 +03:00
|
|
|
) { }
|
|
|
|
|
|
|
|
ngOnInit() {
|
2020-03-24 00:52:08 +07:00
|
|
|
this.seoService.setTitle('TV view');
|
2020-03-14 13:48:01 +07:00
|
|
|
this.websocketService.want(['blocks', 'live-2h-chart', 'mempool-blocks']);
|
2019-08-15 14:50:05 +03:00
|
|
|
|
2019-07-27 18:43:17 +03:00
|
|
|
this.apiService.list2HStatistics$()
|
|
|
|
.subscribe((mempoolStats) => {
|
|
|
|
this.mempoolStats = mempoolStats;
|
|
|
|
this.loading = false;
|
|
|
|
});
|
|
|
|
|
2020-02-16 22:15:07 +07:00
|
|
|
this.stateService.live2Chart$
|
2019-07-27 18:43:17 +03:00
|
|
|
.subscribe((mempoolStats) => {
|
|
|
|
this.mempoolStats.unshift(mempoolStats);
|
|
|
|
this.mempoolStats = this.mempoolStats.slice(0, this.mempoolStats.length - 1);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|