Closed creynders closed 10 years ago
Definitely like the idea of setting up the mappings in external files and pulling them into the Context. Otherwise the Context file could definitely grow into an unwieldy beast. Let's track this separately as https://github.com/ModelN/backbone.geppetto/issues/35
Any more thoughts on this? The current project I'm working on could really benefit from DI, it'd be nice to get this pushed through. I'll gladly do all necessary changes, but need an idea on which changes you guys want. Shall I leave the messaging as is and just prepare everything concerning DI?
I'm on vacation at the moment and our team design review is not until the end of the month so that is the soonest that we could finalize any changes. Unfortunately we need to be a bit more slow moving on this since we have built two large enterprise apps on Geppetto and need to find time in our project cycle when everyone has time to review the changes and the impact on existing code.
That being said I do expect the DI stuff to be supported so I think you can move forward with your DI related changes. I'll keep you updated as things progress.
On Sunday, September 15, 2013, creynders wrote:
Any more thoughts on this? The current project I'm working on could really benefit from DI, it'd be nice to get this pushed through. I'll gladly do all necessary changes, but need an idea on which changes you guys want. Shall I leave the messaging as is and just prepare everything concerning DI?
— Reply to this email directly or view it on GitHubhttps://github.com/ModelN/backbone.geppetto/issues/32#issuecomment-24466282 .
map
methods renamed to wire
Awesome work! What's the status with this? Is that api above ready for use?
@flashape : Working on finalizing and documenting the API in the next week or so. Sorry for the delays. Not everything above has been implemented yet, but the heart of the DI APIs are now working.
We have been using the new APIs in production at my company and I don't foresee any major changes from what's currently in master. So if you're ready to roll with the new DI stuff, and you can get by without the docs for now, you can safely go ahead.
I'll send out an email to the Geppetto Google Group when the docs are done.
The API above has been fully implemented*. Huge thanks to @creynders for putting the work into enumerating these methods. I'll be using this list to update the README soon.
*the one exception is that we decided not to rename dispatch
to trigger
. We can revisit this in a separate issue later on, but for now we did not see the need.
API proposition for Backbone.Geppetto:
Based on #22, #24 and #28
createChildResolver()
<-Injector#createChildInjector
getObject(key)
unchangedwireValue(key, value)
<-Injector#mapValue
hasWiring(key)
<-Injector#hasMapping
wireClass(key, clazz)
<-Injector#mapClass
wireView(key, clazz)
<-Injector#mapView
wireSingleton(key, clazz)
<-Injector#mapSingleton
instantiate(key)
unchangedresolve(instance)
<-Injector#injectInto
release(key)
<-Injector#unmap
releaseAll(key)
<-Injector#unmapAll
bindContext(options)
unchangedon(event, callback, [scope])
<-Context#listen
(Backbone.Events)once(event, callback, [scope])
new (Backbone.Events)off([event], [callback], [scope])
new (Backbone.Events)listenTo(other, event, callback)
<-Context#listen
(Backbone.Events)listenToOnce(other, event, callback)
new (Backbone.Events)stopListening([other], [event], [callback])
new (Backbone.Events)trigger(event, [...args])
<-Context#dispatch
(Backbone.Events)triggerOnParent(event, [...args])
<-Context#dispatchToParent
triggerGlobally(event, [...args])
<-Context#dispatchGlobally
wireCommand(event, commandClass)
<-Context#mapCommand
wireCommands(wirings)
<-Context#mapCommands
destroy()
<-Context#unmapAll
And as an optional parameter to
Context#initialize
:So, what do you think?