]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - client/src/app/environment.ts
Video views is implemented. Closes https://github.com/Chocobozzz/PeerTube/issues/41
[github/Chocobozzz/PeerTube.git] / client / src / app / environment.ts
CommitLineData
ab32b0fc
C
1
2// Angular 2
3// rc2 workaround
4import { enableDebugTools, disableDebugTools } from '@angular/platform-browser';
5import { enableProdMode, ApplicationRef } from '@angular/core';
6// Environment Providers
c16ce1de 7let PROVIDERS: any[] = [
ab32b0fc
C
8 // common env directives
9];
10
11// Angular debug tools in the dev console
12// https://github.com/angular/angular/blob/86405345b781a9dc2438c0fbe3e9409245647019/TOOLS_JS.md
c16ce1de 13let _decorateModuleRef = function identity<T>(value: T): T { return value; };
ab32b0fc
C
14
15if ('production' === ENV) {
ab32b0fc
C
16 enableProdMode();
17
c16ce1de
C
18 // Production
19 _decorateModuleRef = (modRef: any) => {
20 disableDebugTools();
21
22 return modRef;
23 };
24
ab32b0fc
C
25 PROVIDERS = [
26 ...PROVIDERS,
27 // custom providers in production
28 ];
29
30} else {
31
32 _decorateModuleRef = (modRef: any) => {
33 const appRef = modRef.injector.get(ApplicationRef);
34 const cmpRef = appRef.components[0];
35
36 let _ng = (<any>window).ng;
37 enableDebugTools(cmpRef);
38 (<any>window).ng.probe = _ng.probe;
39 (<any>window).ng.coreTokens = _ng.coreTokens;
40 return modRef;
41 };
42
43 // Development
44 PROVIDERS = [
45 ...PROVIDERS,
46 // custom providers in development
47 ];
48
49}
50
51export const decorateModuleRef = _decorateModuleRef;
52
53export const ENV_PROVIDERS = [
54 ...PROVIDERS
55];