Skip to content

Instantly share code, notes, and snippets.

@squeedee
Created June 9, 2010 20:27
Show Gist options
  • Save squeedee/432118 to your computer and use it in GitHub Desktop.
Save squeedee/432118 to your computer and use it in GitHub Desktop.
private function configureUnallocatedDataModel():void {
injector.mapSingleton(UnallocatedJobModel);
// a new injector context, already has it's parentInjector set
var loInjector:IInjector = injector.createChild();
// get the configuration for LO mapping...
var loRule:InjectionConfig = injector.mapClass(ListObserver,ListObserver);
// ...so that we can configure the maping to use the new child injector...
loRule.setInjector(Injector(loInjector));
// ...which we configure with extra mappings
loInjector.mapClass(ProxyManager, ProxyManager);
loInjector.mapSingletonOf(IProxyBuilder, UnallocatedProxyBuilder);
// create the Observer.. how will we manage lifetime? Possibly context level?
var lo:ListObserver = injector.getInstance(ListObserver);
lo.list = UnallocatedJobModel(injector.getInstance(UnallocatedJobModel)).list;
// and remove the child injector.
loRule.setInjector(null);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment