mirror of
https://github.com/bitwarden/browser
synced 2026-02-07 20:24:01 +00:00
19 lines
829 B
TypeScript
19 lines
829 B
TypeScript
import { InjectFlags, InjectOptions, Injector, ProviderToken } from "@angular/core";
|
|
|
|
export class ModalInjector implements Injector {
|
|
constructor(private _parentInjector: Injector, private _additionalTokens: WeakMap<any, any>) {}
|
|
|
|
get<T>(
|
|
token: ProviderToken<T>,
|
|
notFoundValue: undefined,
|
|
options: InjectOptions & { optional?: false }
|
|
): T;
|
|
get<T>(token: ProviderToken<T>, notFoundValue: null, options: InjectOptions): T;
|
|
get<T>(token: ProviderToken<T>, notFoundValue?: T, options?: InjectOptions | InjectFlags): T;
|
|
get<T>(token: ProviderToken<T>, notFoundValue?: T, flags?: InjectFlags): T;
|
|
get(token: any, notFoundValue?: any): any;
|
|
get(token: any, notFoundValue?: any, flags?: any): any {
|
|
return this._additionalTokens.get(token) ?? this._parentInjector.get<any>(token, notFoundValue);
|
|
}
|
|
}
|