API proposition for Backbone.Geppetto:
Based on #22, #24 and #28
createChildResolver() <- Injector#createChildInjector
getObject(key) unchanged
wireValue(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) unchanged
resolve(instance) <- Injector#injectInto
release(key) <- Injector#unmap
releaseAll(key) <- Injector#unmapAll
bindContext(options) unchanged
on(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:
wires:{ //or maybe 'wirings' ?
commands: {
"appEventFoo": FooCommand,
"appEventFooBarBaz": [
FooCommand,
BarCommand,
BazCommand
]
},
singletons: {
foo: Foo
},
classes :{
bar: Bar
},
values : {
someValue: 10
},
views: {
qux : Qux
}
}
So, what do you think?
API proposition for Backbone.Geppetto:
Based on #22, #24 and #28
createChildResolver()<-Injector#createChildInjectorgetObject(key)unchangedwireValue(key, value)<-Injector#mapValuehasWiring(key)<-Injector#hasMappingwireClass(key, clazz)<-Injector#mapClasswireView(key, clazz)<-Injector#mapViewwireSingleton(key, clazz)<-Injector#mapSingletoninstantiate(key)unchangedresolve(instance)<-Injector#injectIntorelease(key)<-Injector#unmapreleaseAll(key)<-Injector#unmapAllbindContext(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#dispatchToParenttriggerGlobally(event, [...args])<-Context#dispatchGloballywireCommand(event, commandClass)<-Context#mapCommandwireCommands(wirings)<-Context#mapCommandsdestroy()<-Context#unmapAllAnd as an optional parameter to
Context#initialize:So, what do you think?