Child Context and Installed Bundles

jj's Avatar

jj

24 Jan, 2014 07:41 PM

How are bundles related to child contexts? Are the bundles of a parent installed and available for the children or just the injector is shared?

ie
` var c1:Context = new Context()
.install( MVCSBundle ) .configure( MyConfig ) .configure( new ContextView( this ) );

var c2:Context = new Context()
.configure( MyConfig2 ) .configure( new ContextView( that ) );

c.addChild( c2 );
`

  1. Support Staff 1 Posted by Ondina D.F. on 25 Jan, 2014 12:10 PM

    Ondina D.F.'s Avatar

    Hi,

    Extensions are not inherited by the child context.

    Each new Context does this:
    _extensionInstaller = new ExtensionInstaller(this);

    When you say context.install(MVCSBundle);

    the Context does this:

    public function install(... extensions):IContext
    {
        for each (var extension:Object in extensions)
        {
            _extensionInstaller.install(extension);
        }
        return this;
    }
    

    _extensionInstaller.install(extension):
    https://github.com/robotlegs/robotlegs-framework/blob/master/src/ro...

    Each Context can use its own extensions defined in a class that implements IBundle. You can add your own extensions to that bundle, or choose only the extensions provided by the framework that you really need in that Context. Say, you don't need the MediatorMapExtension or the TraceLoggingExtension, you simply don't add them to the bundle.

    Each Context does this:

    private const _injector:IInjector = new RobotlegsInjector();

    https://github.com/robotlegs/robotlegs-framework/blob/master/src/ro...

    When a child context is added: https://github.com/robotlegs/robotlegs-framework/blob/master/src/ro...,
    the parent Context does this:

    child.injector.parent = injector;

  2. Ondina D.F. closed this discussion on 03 Feb, 2014 02:07 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac