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

32 lines
790 B
TypeScript

import { NgModule, APP_INITIALIZER } from '@angular/core';
import { UCAP_NATIVE_SERVICE } from '@ucap-webmessenger/native';
import { ElectronNativeService } from '@ucap-webmessenger/native-electron';
import { RESOLVERS } from './resolvers';
import { SERVICES } from './services';
import { AppService } from './services/app.service';
export function initializeApp(appService: AppService) {
return (): Promise<any> => {
return appService.postInit();
};
}
@NgModule({
imports: [],
exports: [],
providers: [
...SERVICES,
...RESOLVERS,
{
provide: APP_INITIALIZER,
useFactory: initializeApp,
deps: [AppService],
multi: true
},
{ provide: UCAP_NATIVE_SERVICE, useClass: ElectronNativeService }
]
})
export class AppProviderModule {}