actionscript-3robotlegsswiftsuspenders

Is better/faster/lighter to inject with metatag or with getters? actionscript 3 / flex


I would like to know which one is better/faster/lighter?

[Inject]
public var myInjection:MyInjection;

OR

[Inject]
public var injector:IInjector;

protected var _myInjection:MyInjection;

public function get myInjection():MyInjection{
    if(!_myInjection) _myInjection = injector.getInstance(MyInjection);
    return _myInjection;
}

?


Solution

  • well the first one is appropriate. The second is weird.

    You've injected the IInjector in a couple of questions. In all of the robotlegs apps I've built I have never needed to inject the injector. The only time I've needed to do that is when I was writing framework extensions/utils.