Settings Service

class SettingsService

This service manages settings.

It:

  1. Provides a snapshot of settings active at that moment.

  2. Updates settings when requested.

  3. Emits the stored settings or Default Settings.

Recipe: Integrate this service with a back-end to store settings, providing a consistent experience for logged-in users across all clients.

settings.service.ts
@Injectable({
  providedIn: 'root',
})
export class SettingsService {
  private readonly _loggerService = inject(LoggerService);
  private readonly _storageService = inject(StorageService);

  private readonly _settings: WritableSignal<Settings>;

  public constructor() {
    // Buy to unlock
  }

  public get settings(): Signal<Settings> {
    // Buy to unlock
  }

  public updateSettings(partialSettings: Partial<Settings>): void {
    // Buy to unlock
  }
}

Last updated