
Security News
NVD Concedes Inability to Keep Pace with Surging CVE Disclosures in 2025
Security experts warn that recent classification changes obscure the true scope of the NVD backlog as CVE volume hits all-time highs.
@anexia/registry-loading-interceptor
Advanced tools
This library provides an interceptor which maps Http Requests to a Loading State.
This library provides an interceptor which maps Http Requests to a Loading State. You're able to subscribe per request to the loading state.
RegisterLoadingInterceptorModule
in your root module (hint: most of the time: app.module.ts)Provides a mechanism to generate an ID from a request. Default ships with a URL to ID example. Trough this Request ID you're able to create a selector to observe the loading state of a single request.
You may not want to map every request to a loading state, this is the place where you can provide a mechanism to filter/exclude request.
Create a service which injects RegistryLoadingInterceptor
and filters RequestID based on the loadingState$
.
Root Module (app.module.ts) registration and configuration
@NgModule({
declarations: [AppComponent],
imports: [
// ... other imports
RegistryLoadingInterceptorModule
],
})
export class AppModule { }
@Injectable({providedIn: 'root'})
export class IsLoadingService {
public constructor(
private readonly loadingRegistry: RegistryLoadingInterceptor,
@Inject(REQUEST_ID_GENERATOR) private readonly idGenerator: UrlFragmentIdGenerator
) {
}
public isLoading$(url: string): Observable<boolean> {
const requestId = this.idGenerator.getIdentifier(url);
return this.loadingRegistry.loadingState$.pipe(
map(state => state.has(requestId) ? state.get(requestId) as boolean : false),
distinctUntilChanged()
);
}
public isAnyLoading$(): Observable<boolean> {
return this.loadingRegistry.isAnyRequestLoading$;
}
}
@Injectable({
providedIn: 'root'
})
export class TestDataAccessService {
private static getUsersEndpoint = '/users';
public userListLoading$: Observable<boolean>;
public constructor(
private readonly httpClient: HttpClient,
private readonly isLoadingService: IsLoadingService
) {
// register request loading listener
this.userListLoading$ = isLoadingService.isLoading$(TestDataAccessService.getUsersEndpoint);
}
public getUsers$(): Observable<unknown> {
return this.httpClient.get(TestDataAccessService.getUsersEndpoint);
}
}
import {Component} from '@angular/core';
import {TestDataAccessService} from "./test-data-access.service";
import {IsLoadingService} from "./is-loading.service";
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.scss']
})
export class AppComponent {
public constructor(
private readonly testDataAccess: TestDataAccessService,
private readonly isLoadingService: IsLoadingService
) {
// connect the facade with the view
testDataAccess.userListLoading$.subscribe(res => console.log('explicit', res));
// implicit loading state, will provide Loadign state for any http request
this.isLoadingService.isAnyLoading$().subscribe(res => console.log('implicit', res));
this.testDataAccess.getUsers$().subscribe(console.log);
}
}
To use custom Request ID Strategy or custom Request Filtering you just need
to provide REQUEST_ID_GENERATOR
or REQUEST_ID_GENERATOR
.
{provide: REQUEST_ID_GENERATOR, useClass: CustomIdGenerator},
FAQs
This library provides an interceptor which maps Http Requests to a Loading State.
The npm package @anexia/registry-loading-interceptor receives a total of 20 weekly downloads. As such, @anexia/registry-loading-interceptor popularity was classified as not popular.
We found that @anexia/registry-loading-interceptor demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 8 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Security experts warn that recent classification changes obscure the true scope of the NVD backlog as CVE volume hits all-time highs.
Security Fundamentals
Attackers use obfuscation to hide malware in open source packages. Learn how to spot these techniques across npm, PyPI, Maven, and more.
Security News
Join Socket for exclusive networking events, rooftop gatherings, and one-on-one meetings during BSidesSF and RSA 2025 in San Francisco.