|
|
@@ -63,6 +63,8 @@ export class MatchDetailsPage implements OnInit { |
|
|
|
|
|
|
|
commentaryList: Array<RawCommentary> = []; |
|
|
|
|
|
|
|
commentaryInterval: any; |
|
|
|
|
|
|
|
constructor( |
|
|
|
private location: Location, |
|
|
|
private route: ActivatedRoute, |
|
|
@@ -77,12 +79,24 @@ export class MatchDetailsPage implements OnInit { |
|
|
|
this.currentMatch = match_data; |
|
|
|
}); |
|
|
|
|
|
|
|
this.callCommentary(match_id); |
|
|
|
|
|
|
|
this.commentaryInterval = setInterval(() => { |
|
|
|
this.callCommentary(match_id); |
|
|
|
}, 30000); |
|
|
|
} |
|
|
|
|
|
|
|
callCommentary(match_id) { |
|
|
|
this.matchService.getCommentary(match_id).then((data: Array<RawCommentary>) => { |
|
|
|
this.commentaryList = data; |
|
|
|
}, (err) => { |
|
|
|
console.log(err); |
|
|
|
this.toastService.presentToastWithOptions("Failed to fetch Commentary", "danger"); |
|
|
|
}) |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
ngOnDestroy() { |
|
|
|
clearInterval(this.commentaryInterval); |
|
|
|
} |
|
|
|
|
|
|
|
getReversedArray(array: Array<RawCommentary>) { |
|
|
|