/
githubmirror
/
tabby
Обзор
Документация
Войти
/
githubmirror
/
tabby
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
app/src/app.module.ts
38 строк
1 KB
Eugene
bootstrap 5 WIP (#7891)
26 фев 2023, 22:42
Не верифицирован
26 фев 2023, 22:42
1e5cfd1
Код
Авторство
О чём код?
/* 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 }