inversify#inject TypeScript Examples
The following examples show how to use
inversify#inject.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ecs-transform.service.ts From nr-apm-stack with Apache License 2.0 | 6 votes |
/**
* Constructor
* @param parsers
* @param logger
*/
constructor(
@multiInject(TYPES.PreInitParser) private preInitParsers: Parser[],
@multiInject(TYPES.InitParser) private initParsers: Parser[],
@multiInject(TYPES.PreParser) private preParsers: Parser[],
@multiInject(TYPES.Parser) private parsers: Parser[],
@multiInject(TYPES.PostParser) private postParsers: Parser[],
@multiInject(TYPES.FinalizeParser) private finalizeParsers: Parser[],
@inject(TYPES.KinesisStreamRecordMapperService) private ksrMapper: KinesisStreamRecordMapperService,
@inject(TYPES.LoggerService) private logger: LoggerService,
) {}
Example #2
Source File: AudioEngine.ts From rewind with MIT License | 6 votes |
constructor(
private readonly audioSettingService: AudioSettingsStore,
@inject(STAGE_TYPES.AUDIO_CONTEXT) private readonly audioContext: AudioContext,
@inject(STAGE_TYPES.EVENT_EMITTER) private readonly eventEmitter: EventEmitter,
) {
this.masterGain = this.audioContext.createGain();
this.musicGain = this.audioContext.createGain();
this.musicGain.connect(this.masterGain);
this.samplesGain = this.audioContext.createGain();
this.samplesGain.connect(this.masterGain);
this.masterGain.connect(this.audioContext.destination);
// this.handleAudioSettingsChanged(this.audioSettingService.getSettings());
}
Example #3
Source File: autowired.ts From malagu with MIT License | 6 votes |
export function applyAutowiredDecorator(option: AutowiredOption, target: any, targetKey: string, index?: number,
doInject: DoInject = ({ id, multi }, t: any, k, i) => multi ? multiInject(id!)(t, k, i) : inject(id!)(t, k, i),
doGetValue: DoGetValue = ({ id, multi }, t, property) => multi ? ContainerUtil.getAll(id!) : ContainerUtil.get(id!)) {
if (option.detached) {
if (index !== undefined) {
throw new Error(`The ${target.constructor.name} itself is not injected into the container, so the parameter injection of the constructor is not supported.`);
}
createAutowiredProperty(option, doGetValue, target, targetKey);
} else {
doInject(option, target, targetKey, index);
}
return option;
}
Example #4
Source File: role.handler.ts From ddd-cqrs-es-aws-sam with MIT License | 6 votes |
constructor (
@inject(DynamoProjectionRepository)
private readonly repository: ProjectionRepository<RoleProjection>,
@inject(WINSTON_SYMBOLS.WinstonConfiguration)
private readonly logger: Logger
) {
super(repository, RoleProjection, Role.name, RoleHandler.projectionTable, logger);
}
Example #5
Source File: dbtProjectContainer.ts From vscode-dbt-power-user with MIT License | 6 votes |
constructor(
private dbtClient: DBTClient,
@inject("Factory<DBTWorkspaceFolder>")
private dbtWorkspaceFolderFactory: (
workspaceFolder: WorkspaceFolder,
_onManifestChanged: EventEmitter<ManifestCacheChangedEvent>
) => DBTWorkspaceFolder
) {
this.disposables.push(
workspace.onDidChangeWorkspaceFolders(async (event) => {
const { added, removed } = event;
await Promise.all(
added.map(
async (folder) => await this.registerWorkspaceFolder(folder)
)
);
removed.forEach((removedWorkspaceFolder) =>
this.unregisterWorkspaceFolder(removedWorkspaceFolder)
);
})
);
}
Example #6
Source File: kinesis-stream-wrapper.service.ts From nr-apm-stack with Apache License 2.0 | 5 votes |
/**
* Construct the wrapper service. The tagging of KinesisStreamService with localhost alters the binding behaviour.
* @param kinesisStreamService
*/
constructor(
@inject(TYPES.KinesisStreamService) @tagged('localhost', true) private kinesisStreamService: KinesisStreamService,
@inject(TYPES.LoggerService) private logger: LoggerService,
) {}
Example #7
Source File: IndexHandler.ts From node-experience with MIT License | 5 votes |
@inject(TYPES.Responder)
private responder: Responder;
Example #8
Source File: index.ts From The-TypeScript-Workshop with MIT License | 5 votes |
constructor(
@multiInject(TYPES.Operator) private operators: Operator[],
@inject(TYPES.Logger) @optional() private logger?: Logger
) {}
Example #9
Source File: BackendStatusService.ts From rewind with MIT License | 5 votes |
constructor(@inject(TYPES.API_URL) private readonly apiUrl: string) {
this.status$ = new BehaviorSubject<BackendState>("NOT_STARTED");
}
Example #10
Source File: ResourcePool.ts From GWebGPUEngine with MIT License | 5 votes |
@inject(IDENTIFIER.RenderEngine)
private readonly engine: IRendererService;