troyanskiy / ngx-resource

Resource (REST) Client for Angular 2
http://troyanskiy.github.io/ngx-resource/
200 stars 46 forks source link

How to cancel the request #175

Closed komarovalexander closed 4 years ago

komarovalexander commented 4 years ago

Hi, which is the best way to cancel the request when you use IResourceMethodPromise?

For example, I need the result of the latest request

onEvent(event){
   this.something =  await this.resource.get(event);
}

onEvent can happen multiple times but I need previous request results to be skipped and only the latest one is applied

is there some common solution for this or should I handle this in my code?