Clear interval on destroy and remove commented code

This commit is contained in:
natsoni 2024-07-13 18:45:18 +09:00
parent 5e8b5e75d8
commit 9ac45a6cc3
No known key found for this signature in database
GPG Key ID: C65917583181743B
2 changed files with 6 additions and 4 deletions

View File

@ -28,9 +28,6 @@
<div class="shape-border waiting"> <div class="shape-border waiting">
<div class="shape animate"></div> <div class="shape animate"></div>
</div> </div>
<!-- <div>
<span class="symbol">< </span><app-fee-rate [fee]="tx.effectiveFeePerVsize" [unitStyle]="{ display: 'block', marginTop: '-0.5em'}"></app-fee-rate>
</div> -->
<div class="status"><span class="badge badge-waiting" i18n="transaction.rbf.mined">Mined</span></div> <div class="status"><span class="badge badge-waiting" i18n="transaction.rbf.mined">Mined</span></div>
</div> </div>
</div> </div>

View File

@ -20,6 +20,7 @@ export class AccelerationTimelineComponent implements OnInit, OnChanges {
now: number; now: number;
accelerateRatio: number; accelerateRatio: number;
useAbsoluteTime: boolean = false; useAbsoluteTime: boolean = false;
interval: number;
constructor() {} constructor() {}
@ -28,7 +29,7 @@ export class AccelerationTimelineComponent implements OnInit, OnChanges {
this.now = Math.floor(new Date().getTime() / 1000); this.now = Math.floor(new Date().getTime() / 1000);
this.useAbsoluteTime = this.tx.status.block_time < this.now - 7 * 24 * 3600; this.useAbsoluteTime = this.tx.status.block_time < this.now - 7 * 24 * 3600;
window.setInterval(() => { this.interval = window.setInterval(() => {
this.now = Math.floor(new Date().getTime() / 1000); this.now = Math.floor(new Date().getTime() / 1000);
this.useAbsoluteTime = this.tx.status.block_time < this.now - 7 * 24 * 3600; this.useAbsoluteTime = this.tx.status.block_time < this.now - 7 * 24 * 3600;
}, 60000); }, 60000);
@ -47,4 +48,8 @@ export class AccelerationTimelineComponent implements OnInit, OnChanges {
// } // }
// } // }
} }
ngOnDestroy(): void {
clearInterval(this.interval);
}
} }