]>
Commit | Line | Data |
---|---|---|
df98563e C |
1 | /* tslint:disable */ |
2 | ||
8635a2c7 C |
3 | /** |
4 | * Angular 2 | |
5 | */ | |
6 | import { | |
7 | enableDebugTools, | |
8 | disableDebugTools | |
9 | } from '@angular/platform-browser'; | |
10 | import { | |
11 | ApplicationRef, | |
12 | enableProdMode | |
13 | } from '@angular/core'; | |
14 | /** | |
15 | * Environment Providers | |
16 | */ | |
c16ce1de | 17 | let PROVIDERS: any[] = [ |
8635a2c7 C |
18 | /** |
19 | * Common env directives | |
20 | */ | |
ab32b0fc C |
21 | ]; |
22 | ||
8635a2c7 C |
23 | /** |
24 | * Angular debug tools in the dev console | |
25 | * https://github.com/angular/angular/blob/86405345b781a9dc2438c0fbe3e9409245647019/TOOLS_JS.md | |
26 | */ | |
27 | let _decorateModuleRef = <T>(value: T): T => { return value; }; | |
ab32b0fc C |
28 | |
29 | if ('production' === ENV) { | |
ab32b0fc C |
30 | enableProdMode(); |
31 | ||
8635a2c7 C |
32 | /** |
33 | * Production | |
34 | */ | |
c16ce1de C |
35 | _decorateModuleRef = (modRef: any) => { |
36 | disableDebugTools(); | |
37 | ||
38 | return modRef; | |
39 | }; | |
40 | ||
ab32b0fc C |
41 | PROVIDERS = [ |
42 | ...PROVIDERS, | |
8635a2c7 C |
43 | /** |
44 | * Custom providers in production. | |
45 | */ | |
ab32b0fc C |
46 | ]; |
47 | ||
48 | } else { | |
49 | ||
50 | _decorateModuleRef = (modRef: any) => { | |
51 | const appRef = modRef.injector.get(ApplicationRef); | |
52 | const cmpRef = appRef.components[0]; | |
53 | ||
8635a2c7 | 54 | let _ng = (<any> window).ng; |
ab32b0fc | 55 | enableDebugTools(cmpRef); |
8635a2c7 C |
56 | (<any> window).ng.probe = _ng.probe; |
57 | (<any> window).ng.coreTokens = _ng.coreTokens; | |
ab32b0fc C |
58 | return modRef; |
59 | }; | |
60 | ||
8635a2c7 C |
61 | /** |
62 | * Development | |
63 | */ | |
ab32b0fc C |
64 | PROVIDERS = [ |
65 | ...PROVIDERS, | |
8635a2c7 C |
66 | /** |
67 | * Custom providers in development. | |
68 | */ | |
ab32b0fc C |
69 | ]; |
70 | ||
71 | } | |
72 | ||
73 | export const decorateModuleRef = _decorateModuleRef; | |
74 | ||
75 | export const ENV_PROVIDERS = [ | |
76 | ...PROVIDERS | |
77 | ]; |