UNPKG

1.97 kBJavaScriptView Raw
1/**
2 * @license
3 * Copyright Google Inc. All Rights Reserved.
4 *
5 * Use of this source code is governed by an MIT-style license that can be
6 * found in the LICENSE file at https://angular.io/license
7 */
8import { OpaqueToken } from './di';
9/**
10 * A DI Token representing a unique string id assigned to the application by Angular and used
11 * primarily for prefixing application attributes and CSS styles when
12 * {@link ViewEncapsulation#Emulated} is being used.
13 *
14 * If you need to avoid randomly generated value to be used as an application id, you can provide
15 * a custom value via a DI provider <!-- TODO: provider --> configuring the root {@link Injector}
16 * using this token.
17 * @experimental
18 */
19export var /** @type {?} */ APP_ID = new OpaqueToken('AppId');
20/**
21 * @return {?}
22 */
23export function _appIdRandomProviderFactory() {
24 return "" + _randomChar() + _randomChar() + _randomChar();
25}
26/**
27 * Providers that will generate a random APP_ID_TOKEN.
28 * @experimental
29 */
30export var /** @type {?} */ APP_ID_RANDOM_PROVIDER = {
31 provide: APP_ID,
32 useFactory: _appIdRandomProviderFactory,
33 deps: /** @type {?} */ ([]),
34};
35/**
36 * @return {?}
37 */
38function _randomChar() {
39 return String.fromCharCode(97 + Math.floor(Math.random() * 25));
40}
41/**
42 * A function that will be executed when a platform is initialized.
43 * @experimental
44 */
45export var /** @type {?} */ PLATFORM_INITIALIZER = new OpaqueToken('Platform Initializer');
46/**
47 * All callbacks provided via this token will be called for every component that is bootstrapped.
48 * Signature of the callback:
49 *
50 * `(componentRef: ComponentRef) => void`.
51 *
52 * @experimental
53 */
54export var /** @type {?} */ APP_BOOTSTRAP_LISTENER = new OpaqueToken('appBootstrapListener');
55/**
56 * A token which indicates the root directory of the application
57 * @experimental
58 */
59export var /** @type {?} */ PACKAGE_ROOT_URL = new OpaqueToken('Application Packages Root URL');
60//# sourceMappingURL=application_tokens.js.map
\No newline at end of file