tabby/app/src/app.module.ts
Eugene 1e5cfd1d4b
bootstrap 5 WIP (#7891)
New standard theme that follows your chosen terminal colors, Bootstrap 5 & Angular 15 upgrade
2023-02-26 20:42:31 +01:00

39 lines
1.1 KiB
TypeScript

/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
import { ApplicationRef, NgModule } from '@angular/core'
import { BrowserModule } from '@angular/platform-browser'
import { ToastrModule } from 'ngx-toastr'
export function getRootModule (plugins: any[]) {
const imports = [
BrowserModule,
...plugins,
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,
}) class RootModule {
ngDoBootstrap (appRef: ApplicationRef) {
(window as any)['requestAnimationFrame'] = window[window['Zone'].__symbol__('requestAnimationFrame')]
const componentDef = bootstrap[0]
appRef.bootstrap(componentDef)
}
}
return RootModule
}