mirror of
https://github.com/angular/angular
synced 2026-05-24 09:28:37 +00:00
DestroyRef represents a concept of lifecycle scope where destroy callbacks can be registered. Such callbacks are automatically executed when a given scope ends it lifecycle. In practice the most common lifecycle scopes would be represented by: - a component or en embedded view; - instance of `EnvironnementInjector`. PR Close #49158
33 lines
1.6 KiB
TypeScript
33 lines
1.6 KiB
TypeScript
/**
|
|
* @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.io/license
|
|
*/
|
|
|
|
import {getClosureSafeProperty} from '../util/property';
|
|
|
|
export const NG_COMP_DEF = getClosureSafeProperty({ɵcmp: getClosureSafeProperty});
|
|
export const NG_DIR_DEF = getClosureSafeProperty({ɵdir: getClosureSafeProperty});
|
|
export const NG_PIPE_DEF = getClosureSafeProperty({ɵpipe: getClosureSafeProperty});
|
|
export const NG_MOD_DEF = getClosureSafeProperty({ɵmod: getClosureSafeProperty});
|
|
export const NG_FACTORY_DEF = getClosureSafeProperty({ɵfac: getClosureSafeProperty});
|
|
|
|
/**
|
|
* If a directive is diPublic, bloomAdd sets a property on the type with this constant as
|
|
* the key and the directive's unique ID as the value. This allows us to map directives to their
|
|
* bloom filter bit for DI.
|
|
*/
|
|
// TODO(misko): This is wrong. The NG_ELEMENT_ID should never be minified.
|
|
export const NG_ELEMENT_ID = getClosureSafeProperty({__NG_ELEMENT_ID__: getClosureSafeProperty});
|
|
|
|
/**
|
|
* The `NG_ENV_ID` field on a DI token indicates special processing in the `EnvironmentInjector`:
|
|
* getting such tokens from the `EnvironmentInjector` will bypass the standard DI resolution
|
|
* strategy and instead will return implementation produced by the `NG_ENV_ID` factory function.
|
|
*
|
|
* This particular retrieval of DI tokens is mostly done to eliminate circular dependencies and
|
|
* improve tree-shaking.
|
|
*/
|
|
export const NG_ENV_ID = getClosureSafeProperty({__NG_ENV_ID__: getClosureSafeProperty});
|