thiagobustamante / typescript-ioc

A Lightweight annotation-based dependency injection container for typescript.
MIT License
526 stars 64 forks source link

Async provider #41

Open ghost opened 6 years ago

ghost commented 6 years ago

Hey guys,

is there any support for async providers / resolving dependencies asynchronously?

Example:

const configProvider: Provider = {
  async get () => {
    const config = await loadConfig(process.env.NODE_ENV)
    return config
  }
}

Many thanks Juraj

cosmoKenney commented 6 years ago

I'm wondering the same thing. I'd like to use webpack import() to lazy load chunks of my application. So that when a user hits a top-level route (this is a SPA app) for the first time I can lazy load the chunk then start displaying the components.