Code Explainers

Code explainers tagged #singleton

typescript
import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { Observable, shareReplay } from 'rxjs';
 

Caching HTTP config in an Angular service

caching observables dependency-injection
Intermediate 6 steps
typescript
// A module-scoped Singleton: the single instance lives in this module's
// closure and is never exposed directly.
 
interface AppConfig {

A module-scoped Singleton in TypeScript

singleton generics encapsulation
Intermediate 7 steps