mempool/frontend/src/app/components/blockchain/blockchain.component.ts

34 lines
809 B
TypeScript
Raw Normal View History

import { Component, OnInit, OnDestroy } from '@angular/core';
2019-07-24 23:08:28 +03:00
import { Subscription } from 'rxjs';
import { take } from 'rxjs/operators';
import { StateService } from 'src/app/services/state.service';
2019-07-21 17:59:47 +03:00
@Component({
selector: 'app-blockchain',
templateUrl: './blockchain.component.html',
styleUrls: ['./blockchain.component.scss']
})
export class BlockchainComponent implements OnInit, OnDestroy {
2019-07-24 23:08:28 +03:00
blocksSubscription: Subscription;
2019-07-21 17:59:47 +03:00
txTrackingLoading = false;
txShowTxNotFound = false;
2019-07-24 23:08:28 +03:00
isLoading = true;
2019-07-21 17:59:47 +03:00
constructor(
private stateService: StateService,
2019-07-21 17:59:47 +03:00
) {}
ngOnInit() {
this.blocksSubscription = this.stateService.blocks$
2019-07-24 23:08:28 +03:00
.pipe(
take(1)
)
.subscribe(() => this.isLoading = false);
2019-07-21 17:59:47 +03:00
}
ngOnDestroy() {
2019-07-24 23:08:28 +03:00
this.blocksSubscription.unsubscribe();
2019-07-21 17:59:47 +03:00
}
}