What's the correct way to register new factories at runtime?


#1

What’s the correct way to register new factories at runtime? As far as I can tell, there are only two options:

  1. container.register(type, factory) – this emits a deprecation warning. See https://github.com/emberjs/ember.js/blob/v1.12.0/packages/container/lib/container.js#L160-L185
  2. container._registry.register(type, factory) – this relies on a private API. See https://github.com/emberjs/ember.js/blob/v1.12.0/packages/container/lib/container.js#L178 in particular.