inversify#optional TypeScript Examples

The following examples show how to use inversify#optional. 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: channel-manager.ts    From malagu with MIT License 6 votes vote down vote up
constructor(
        @Autowired(ConnectionHandler) @optional()
        protected readonly handlers: ConnectionHandler[],
        @Autowired(ConnnectionFactory) protected connnectionFactory: ConnnectionFactory<Channel>
    ) {
        for (const handler of handlers) {
            this._handlers.set(handler.path, handler);
        }
    }
Example #2
Source File: index.ts    From The-TypeScript-Workshop with MIT License 5 votes vote down vote up
constructor(
    @multiInject(TYPES.Operator) private operators: Operator[],
    @inject(TYPES.Logger) @optional() private logger?: Logger
  ) {}