next-ucap-messenger/projects/ucap-webmessenger-app/src/app/app-provider.module.ts

30 lines
731 B
TypeScript
Raw Normal View History

2019-09-19 01:40:16 +00:00
import { NgModule, APP_INITIALIZER } from '@angular/core';
2019-09-18 06:02:21 +00:00
import { UCAP_NATIVE_SERVICE } from '@ucap-webmessenger/native';
import { ElectronNativeService } from '@ucap-webmessenger/native-electron';
2019-09-19 01:40:16 +00:00
import { SERVICES } from './services';
import { AppService } from './services/app.service';
export function initializeApp(appService: AppService) {
return (): Promise<any> => {
return appService.postInit();
};
}
2019-09-18 06:02:21 +00:00
@NgModule({
imports: [],
exports: [],
providers: [
...SERVICES,
2019-09-19 01:40:16 +00:00
{
provide: APP_INITIALIZER,
useFactory: initializeApp,
deps: [AppService],
multi: true
},
2019-09-18 06:02:21 +00:00
{ provide: UCAP_NATIVE_SERVICE, useClass: ElectronNativeService }
]
})
export class AppProviderModule {}