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