inversify / InversifyJS

A powerful and lightweight inversion of control container for JavaScript & Node.js apps powered by TypeScript.
http://inversify.io/
MIT License
11.15k stars 712 forks source link

How to rebind named binding? #853

Open akosyakov opened 6 years ago

akosyakov commented 6 years ago

See https://github.com/theia-ide/theia/pull/1664/files#r182040835

remojansen commented 6 years ago

@akosyakov seems like we need to implement rebindNamed and rebindTagged()?

tonyhallett commented 5 years ago

See #447 for a solution

tonyhallett commented 5 years ago

I would happily do a pull request. Should the container have the method ? Should the binding syntax be extended ? container.bind(IThing).to(Thing) returns interface something like

interface UnbindRebind<T>{
unbind():void
rebind<T>:interfaces.BindingToSyntax<T>
rebindValue(newValue:any):void//or rebindTo/rebindToSelf
}
tonyhallett commented 5 years ago

I have opted for extending the fluent syntax. I should hopefully have a pull request tomorrow.