actionscript 3 - SwiftSuspenders not working like it should? -


i'm getting feet wet trying use swift suspenders as3 project injections null when try access them. works when use injector.injectinto() explicitly inject object should have reference. can't optimal approach swiftsuspenders, right?

aren't change accessing injected properties in class constructor? if so, use postconstruct meta.

public class example {     [inject] public var foo:bar;      public function example()     {         foo.barme(); // throws null reference error     }      [postconstruct]     public function _postconstruct():void     {         foo.barme(); // ok     } } 

postconstruct: automatically invoking methods on injection completion

instances of classes depend on automatic di ready used after di has completed. annotating methods in injectee class [postconstruct] metadata causes them invoked directly after injections have completed , safe use instance. multiple methods can invoked in defined order using order parameter: [postconstruct(order=1)].

ref [1]


Comments

Popular posts from this blog

Python __call__ special method practical example -

How can I edit my VIM config so that Vim treats ".ejs" files the same as it currently treats my html files? -