/
githubmirror
/
angular
Обзор
Документация
Войти
/
githubmirror
/
angular
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
adev/src/app/editor/code-editor/services/diagnostics-state.service.ts
28 строк
844 B
Kristiyan Kostadinov
fix(docs-infra): switch remaining adev services to `@Service`
08 май 2026, 01:23
08 май 2026, 01:23
1f238ab
Код
Авторство
О чём код?
/*! * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.dev/license */ import {Service} from '@angular/core'; import {Diagnostic} from '@codemirror/lint'; import {BehaviorSubject, distinctUntilChanged} from 'rxjs'; export interface DiagnosticWithLocation extends Diagnostic { lineNumber: number; characterPosition: number; } @Service() export class DiagnosticsState { private readonly _diagnostics$ = new BehaviorSubject<DiagnosticWithLocation[]>([]); // TODO: use signals when zoneless will be turned off diagnostics$ = this._diagnostics$.asObservable().pipe(distinctUntilChanged()); setDiagnostics(diagnostics: DiagnosticWithLocation[]): void { this._diagnostics$.next(diagnostics); } }