mirror of
https://github.com/bitwarden/browser
synced 2025-12-16 16:23:44 +00:00
40 lines
1.1 KiB
TypeScript
40 lines
1.1 KiB
TypeScript
import { CommonModule } from "@angular/common";
|
|
import { ModuleWithProviders, NgModule } from "@angular/core";
|
|
import { DefaultNoComponentGlobalConfig, GlobalConfig, TOAST_CONFIG } from "ngx-toastr";
|
|
|
|
import { ToastComponent } from "./toast.component";
|
|
import { BitwardenToastrComponent } from "./toastr.component";
|
|
|
|
@NgModule({
|
|
imports: [CommonModule, ToastComponent],
|
|
declarations: [BitwardenToastrComponent],
|
|
exports: [BitwardenToastrComponent],
|
|
})
|
|
export class ToastModule {
|
|
static forRoot(config: Partial<GlobalConfig> = {}): ModuleWithProviders<ToastModule> {
|
|
return {
|
|
ngModule: ToastModule,
|
|
providers: [
|
|
{
|
|
provide: TOAST_CONFIG,
|
|
useValue: {
|
|
default: BitwardenToastrGlobalConfig,
|
|
config: config,
|
|
},
|
|
},
|
|
],
|
|
};
|
|
}
|
|
}
|
|
|
|
export const BitwardenToastrGlobalConfig: GlobalConfig = {
|
|
...DefaultNoComponentGlobalConfig,
|
|
toastComponent: BitwardenToastrComponent,
|
|
tapToDismiss: false,
|
|
timeOut: 5000,
|
|
extendedTimeOut: 2000,
|
|
maxOpened: 5,
|
|
autoDismiss: true,
|
|
progressBar: true,
|
|
};
|