mirror of
https://github.com/bitwarden/directory-connector
synced 2025-12-05 23:53:21 +00:00
21 lines
738 B
TypeScript
21 lines
738 B
TypeScript
import { 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): 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);
|
|
}
|
|
}
|