Is there a way to implement a setTimeout for only one asynchronous call? I need to set a timeout before calling the GetData function from the dataservice, but it should be specific to only one asynchronous call. Any suggestions? Thank you.
#html code
<app-table-multi-sort (dataServiceEvent)="dataServiceEvent($event)"></app-table-multi-sort>
#ts code
dataServiceEvent(item) {
this.table = item;
if (this.table) {
setTimeout(()=>{
this._GetData()
},500);
}
}
private GetData() {
this.isLoading = true;
this._brokerOpinionOfValueService
.getAllWAGBOVs(
this.accountId,
this.table.pageIndex + 1,
this.table.pageSize,
this.searchInput.nativeElement.value,
this.table.sortParams,
this.table.sortDirs
)
.pipe(finalize(() => (this.isLoading = false)))
.subscribe({
error: (err) => this._notificationService.showError(err),
next: (res) => {
},
complete: noop,
});
}