You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

14 lines
413 B

import { BackendSrv } from 'app/core/services/backend_srv';
import { MonoTypeOperatorFunction } from 'rxjs';
import { finalize } from 'rxjs/operators';
export function cancelNetworkRequestsOnUnsubscribe<T>(
backendSrv: BackendSrv,
requestId: string | undefined
): MonoTypeOperatorFunction<T> {
return finalize(() => {
if (requestId) {
backendSrv.resolveCancelerIfExists(requestId);
}
});
}