aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/app.module.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-06-04 14:39:47 +0200
committerChocobozzz <me@florianbigard.com>2021-06-04 15:45:44 +0200
commitfc21ef5c62d845576a916414468b3a57370a57b2 (patch)
tree818102bc909210870f9a28692361f7b5cbe219de /client/src/app/app.module.ts
parent2989628b7913383b39ac34c7db8666a21f8e5037 (diff)
downloadPeerTube-fc21ef5c62d845576a916414468b3a57370a57b2.tar.gz
PeerTube-fc21ef5c62d845576a916414468b3a57370a57b2.tar.zst
PeerTube-fc21ef5c62d845576a916414468b3a57370a57b2.zip
Speed up plugins loading
Diffstat (limited to 'client/src/app/app.module.ts')
-rw-r--r--client/src/app/app.module.ts17
1 files changed, 12 insertions, 5 deletions
diff --git a/client/src/app/app.module.ts b/client/src/app/app.module.ts
index ea53818e1..dfdccbe69 100644
--- a/client/src/app/app.module.ts
+++ b/client/src/app/app.module.ts
@@ -1,4 +1,5 @@
1import 'focus-visible' 1import 'focus-visible'
2import { tap } from 'rxjs/operators'
2import { environment } from 'src/environments/environment' 3import { environment } from 'src/environments/environment'
3import { APP_BASE_HREF, registerLocaleData } from '@angular/common' 4import { APP_BASE_HREF, registerLocaleData } from '@angular/common'
4import { APP_INITIALIZER, NgModule } from '@angular/core' 5import { APP_INITIALIZER, NgModule } from '@angular/core'
@@ -7,7 +8,7 @@ import { ServiceWorkerModule } from '@angular/service-worker'
7import localeOc from '@app/helpers/locales/oc' 8import localeOc from '@app/helpers/locales/oc'
8import { AppRoutingModule } from './app-routing.module' 9import { AppRoutingModule } from './app-routing.module'
9import { AppComponent } from './app.component' 10import { AppComponent } from './app.component'
10import { CoreModule, ServerService } from './core' 11import { CoreModule, PluginService, ServerService } from './core'
11import { EmptyComponent } from './empty.component' 12import { EmptyComponent } from './empty.component'
12import { HeaderComponent, SearchTypeaheadComponent, SuggestionComponent } from './header' 13import { HeaderComponent, SearchTypeaheadComponent, SuggestionComponent } from './header'
13import { HighlightPipe } from './header/highlight.pipe' 14import { HighlightPipe } from './header/highlight.pipe'
@@ -26,8 +27,14 @@ import { SharedUserInterfaceSettingsModule } from './shared/shared-user-settings
26 27
27registerLocaleData(localeOc, 'oc') 28registerLocaleData(localeOc, 'oc')
28 29
29export function loadConfigFactory (server: ServerService) { 30export function loadConfigFactory (server: ServerService, pluginService: PluginService) {
30 return () => server.loadHTMLConfig() 31 return () => {
32 const result = server.loadHTMLConfig()
33
34 if (result) return result.pipe(tap(() => pluginService.initializePlugins()))
35
36 return pluginService.initializePlugins()
37 }
31} 38}
32 39
33@NgModule({ 40@NgModule({
@@ -75,9 +82,9 @@ export function loadConfigFactory (server: ServerService) {
75 { 82 {
76 provide: APP_INITIALIZER, 83 provide: APP_INITIALIZER,
77 useFactory: loadConfigFactory, 84 useFactory: loadConfigFactory,
78 deps: [ ServerService ], 85 deps: [ ServerService, PluginService ],
79 multi: true 86 multi: true
80 } 87 }
81 ] 88 ]
82}) 89})
83export class AppModule {} 90export class AppModule {}