tabby/app/src/app.module.ts
2022-06-15 20:02:00 +02:00

39 lines
1.1 KiB
TypeScript

/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
import { NgModule } from '@angular/core'
import { BrowserModule } from '@angular/platform-browser'
import { NgbModule } from '@ng-bootstrap/ng-bootstrap'
import { ToastrModule } from 'ngx-toastr'
export function getRootModule (plugins: any[]) {
const imports = [
BrowserModule,
...plugins,
NgbModule,
ToastrModule.forRoot({
positionClass: 'toast-bottom-center',
toastClass: 'toast',
preventDuplicates: true,
extendedTimeOut: 1000,
}),
]
const bootstrap = [
...plugins.filter(x => x.bootstrap).map(x => x.bootstrap),
]
if (bootstrap.length === 0) {
throw new Error('Did not find any bootstrap components. Are there any plugins installed?')
}
@NgModule({
imports,
bootstrap,
}) class RootModule {
ngDoBootstrap () {
(window as any)['requestAnimationFrame'] = window[window['Zone'].__symbol__('requestAnimationFrame')]
}
}
return RootModule
}