/
githubmirror
/
angular
Обзор
Документация
Войти
/
githubmirror
/
angular
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
devtools/projects/ng-devtools/src/lib/application-providers/supported_apis.ts
46 строк
1 KB
hawkgs
refactor(devtools): add property show graph button (#62853)
20 авг 2025, 12:04
20 авг 2025, 12:04
863401b
Код
Авторство
О чём код?
/** * @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 {InjectionToken, signal} from '@angular/core'; import {SupportedApis} from '../../../../protocol'; /** A signal derivative containing all DevTools supported APIs. */ export interface SupportedApisSignal { /** Returns the supported APIs read-only signal. */ (): SupportedApis; /** Initialize (set once) the supported APIs. */ init: (supportedApis: SupportedApis) => void; } export const SUPPORTED_APIS = new InjectionToken<SupportedApisSignal>('SUPPORTED_APIS', { providedIn: 'root', factory: () => { let isSet = false; const apis = signal<SupportedApis>({ profiler: false, dependencyInjection: false, routes: false, signals: false, transferState: false, signalPropertiesInspection: false, }); const apisReadonlySignal = apis.asReadonly(); const readonlyApis = () => apisReadonlySignal(); readonlyApis.init = (supportedApis: SupportedApis) => { if (isSet) { throw new Error('Supported APIs signal is already set.'); } apis.set(supportedApis); isSet = true; }; return readonlyApis; }, });