mempool/frontend/src/app/lightning/nodes-ranking/nodes-ranking.component.ts

30 lines
946 B
TypeScript
Raw Normal View History

2022-08-17 12:53:26 +02:00
import { ChangeDetectionStrategy, Component, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { LightningApiService } from '../lightning-api.service';
import { share } from 'rxjs/operators';
import { Observable } from 'rxjs';
2023-12-14 12:22:00 +01:00
import { INodesStatistics } from '../../interfaces/node-api.interface';
2022-08-17 12:53:26 +02:00
@Component({
selector: 'app-nodes-ranking',
templateUrl: './nodes-ranking.component.html',
styleUrls: ['./nodes-ranking.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class NodesRanking implements OnInit {
type: string;
2023-12-14 12:22:00 +01:00
statistics$: Observable<INodesStatistics>;
constructor(
private route: ActivatedRoute,
private lightningApiService: LightningApiService,
) {}
2022-08-17 12:53:26 +02:00
ngOnInit(): void {
this.statistics$ = this.lightningApiService.getLatestStatistics$().pipe(share());
this.route.data.subscribe(data => {
this.type = data.type;
});
2022-08-17 12:53:26 +02:00
}
}