container-ioc icon indicating copy to clipboard operation
container-ioc copied to clipboard

Implement asynchronous injection with async factories

Open basedalexander opened this issue 7 years ago • 1 comments

The idea is to add ability of injecting stuff asynchronously. The syntax example:

{ 
      token: 'IConfig',
      useFactory: async (service: any) => {
              const something = await.service.getSomething();
              return something;
      },
     inject: [Service]
}

basedalexander avatar Nov 03 '18 08:11 basedalexander

Does that mean resolve would always return a promise? Or do you plan on adding a resolveAsync (in which case the consumer should know if the dependencies are resolved asyn)?

andrei-tatar avatar Dec 06 '18 12:12 andrei-tatar