🍪Token registration
register, registerTypes, asSingleton, asFactory
Value can be a class definition, primitive, or a function.
container.register('key', value)
New Instance
container.register('key2', value).asPrototype()
Use the same instance (default)
container.register('key3', value).asSingleton()
Register with context: @Inject('paramKey') ... it will replace injection keys (this enables to create different variants)
container.register('key4', value)
.asSingleton()
.withContext({'paramKey': 'otherKey', 'paramKey2': 'otherKey2'})
Register constant (can be primitive, function, etc)
container.register('key4', 'some constant').asConstant()
Registration by type with a random key (if you don't want to enable auto-creation you can still use this)
container.registerTypes([MyClass, Myclass2])
Factory
container.register('factoryKey', FactoryClass).asFactory();
container.register('factoryResult', String).asFactoryResult('factoryKey');