by

Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Apr 08 16:03
    davidgiven opened #312
  • Feb 26 08:49
    desca595 removed as member
  • Jan 15 09:58
    CrazyFlasher synchronize #80
  • Jan 15 09:23
    CrazyFlasher commented #311
  • Jan 15 09:17
    CrazyFlasher opened #80
  • Jan 15 08:43
    CrazyFlasher commented #311
  • Jan 15 08:43
    CrazyFlasher commented #311
  • Jan 15 08:26
    CrazyFlasher commented #311
  • Jan 14 08:30
    CrazyFlasher edited #311
  • Jan 14 08:30
    CrazyFlasher opened #311
  • Oct 23 2019 16:33
    CrazyFlasher commented #310
  • Oct 23 2019 16:31
    CrazyFlasher commented #310
  • Oct 23 2019 16:30
    CrazyFlasher commented #310
  • Oct 23 2019 16:30
    CrazyFlasher commented #310
  • Oct 23 2019 13:15
    st3veV commented #310
  • Oct 23 2019 13:00
    CrazyFlasher opened #310
  • Oct 21 2019 20:08
    CrazyFlasher edited #309
  • Oct 21 2019 20:07
    CrazyFlasher opened #309
  • Oct 21 2019 10:42
    back2dos reopened #308
  • Oct 21 2019 10:42
    back2dos commented #308
St3veV
@st3veV
that way view doesn't know where the method is coming from, it only cares about calling it... it's the modules responsibility to provide that function
... and as always, sorry for the late response and thank you for your patience ;)
MIchael Solomon
@mikicho
Thanks a lot! I updated my repository with some fixes...
I encounter with irritating problem, in My model I trying to fire a trigger, but it's not file anything for some reason the trigger is empty(in console I see: Object { _inputs: Array[0] }) it worked before my changes :( please take a look.
MIchael Solomon
@mikicho
Now the view AND the model are trigger owner, maybe there is a problem with that?
MIchael Solomon
@mikicho

I'm continue trying some things with hexMachina and I inject controller to my view:

@Inject
 public var controller:IGeneratorController;

When I tried in module insert the view into injector like following, it didn't worked:

this.getInjector().mapToValue(ITransferView, transferView);

But this working:

this.getInjector().injectInto(transferView);

what injectInto do?
And also, I should to "attach" to view into the module (i.e "mapToValue") and not the module to view (i.e "injectInto"), I'm afraid that I not exactly understand the "Injector" thing...

MIchael Solomon
@mikicho
Hm... I think I understand the injector thing: each object that implements IInjectorContainer get an injector object, but it's empty, so in the module I should "share" the module's injector with view's injector by this.getInjector().injectInto(transferView);, but if I want add something to module injector I just need to "map it in" by this.getInjector().map methods or by this._map etc...
St3veV
@st3veV
so first about the injector... if a class implements IInjectorContainer it will get a special reflection treatment to convert all the metadata into executable code so to make it the injection perform a bit faster than using standard Reflect.
so class that implements IInjectorContainer doesn't actually include injector... it just means that it can be injected into
St3veV
@st3veV
the way map method works is following:
// code:
injector.map(ClassX).toValue(x);
// english:
// every time when something requires ClassX provide it this specific value x ... aka singleton pattern
//-----
// code:
injector.map(ClassX).toType(ClassX);
// english:
// every time when something requires ClassX create a new instance of ClassX and provide that instance ... aka factory pattern
so that's what map does
injector.injectInto(instance) does following... it takes the instance you're passing in and goes through all the pre-reflected data (generated by the IInjectorContainer described above) and does injector.getInstance(_whatever type is the public variable type_) which returns instances based on the mapping (or rules in other words) described above
so yes... you understand it pretty much correctly.... btw: in the module this._map is just a shortcut for this._injector.map
St3veV
@st3veV
I'll look through yout code later this week when I have more time
btw: a small teaser - myself and @aliokan will host a hands-on hexMachina injector and DSL workshop at Haxe Summit in September and all the things I described above will be there with Rick and Morty themed coding examples and exercises ;)
MIchael Solomon
@mikicho
OH WOW so I'll see there then!
I still have this problem in the model! it's freak me out because it worked before
MIchael Solomon
@mikicho
Hey guys!
After some other tasks that I had to do I come back to hexMachina.
I solved this problem now but to understand, if I'm not mapping as singleton (i.e: this._map(ILoginModel, LoginModel, '', true);) so when I'm doing _get (i.e: this._get(ILoginModel)) I'm getting a new instance of LoginModel? (lol when I'm writing this it's makes more sense)
St3veV
@st3veV
btw: here's the mentioned workshop - https://github.com/DoclerLabs/hexWorkshop slides for each section are written in markdown in each corresponding folder (for example: hexInject/slides_content.md)
Andor Polgar
@andormade
hello I have a problem with hexmachina
Laurent Deketelaere
@aliokan
Hey
Which kind of problem?
MIchael Solomon
@mikicho
@andormade Also, I recommend you to brief on the 100-200 last messages, I asked a lot of newbies questions :)
@st3veV I wanted to put a link to the great rick and morty workshop, but didn't find it on Summit youtube channel: https://www.youtube.com/channel/UCGTson1aVohkJnbrqpNBXqg/videos?sort=dd&view=0&shelf_id=0
Laurent Deketelaere
@aliokan
Video for room 2 still in progress. They should arrive soon
MIchael Solomon
@mikicho
Thanks :)
MIchael Solomon
@mikicho
This is really excuting you guys remove a lit of reflections and such as we talked about a "light year" ago :)
Leo Bergman
@lbergman
Hi! Trying to replace minject with hexinject, since minject break completion server support, but having some issues getting injections working
Have this main class:

class Main extends App {
    static function main() {
        new Main();
    }

    override function init() {
        super.init();
        var injector = new Injector();
        var vo = new VO();
        vo.val = 'bar';
        injector.map(VO).toValue(vo);

        var container = new Container();
        injector.injectInto(container);
    }
}
This is VO:
class VO {
    public var val = 'foo';
    public function new() {
    }
}
And Container:
class Container implements hex.di.IInjectorContainer {

    @inject
    var _vo:VO;

    public function new() {
    }

    @PostConstruct
    public function enter() {
        trace("vo.val:" + _vo.val);
    }
}
When it gets to Container.enter it fails with Uncaught TypeError: Cannot read property 'val' of undefined
Dmitry
@dmitry-kuzovatkin
can you try @inject -> @Inject
Leo Bergman
@lbergman
Aha...will do :)
Thanks...that resolved the error, however now getting Uncaught TypeError: mapping.getResult is not a function
Laurent Deketelaere
@aliokan
just tried your example, with uppercase I and its working
import hex.di.Injector;

class Main {
    static function main() {
        new Main();
    }

    function new() {
        var injector = new Injector();
        var vo = new VO();
        vo.val = 'bar';
        injector.map(VO).toValue(vo);

        var container = new Container();
        injector.injectInto(container);
    }
}
class Container implements hex.di.IInjectorContainer {

    @Inject
    var _vo:VO;

    public function new() {
    }

    @PostConstruct
    public function enter() {
        trace("vo.val:" + _vo.val);
    }
}
build.hxml
-cp src
-main Main

-lib hexdsl
-js main.js
output vo.val:bar
Leo Bergman
@lbergman
Thanks...seems the culprit was that I was using '-dce full'. Is hexinject not compatible with DCE?
Dmitry
@dmitry-kuzovatkin
which version do you use?
Leo Bergman
@lbergman
0.35.0
Laurent Deketelaere
@aliokan
OK, able to reproduce the error with -dce full
I will open an issue
Leo Bergman
@lbergman
thanks! got same with 1.0.0-alpha.2
Leo Bergman
@lbergman
Added @:keep to hex.di.mapping.InjectionMapping.getResult and everything seems to work
Laurent Deketelaere
@aliokan
We will fix it
Leo Bergman
@lbergman
super...thanks!
Laurent Deketelaere
@aliokan
BTW, if you want to use full DCE for now, you can use the shorter syntax: injector.mapToValue(VO, vo);
Dmitry
@dmitry-kuzovatkin
imho better to use another notation which works
.mapToValue(VO, vo)
@aliokan first like always
Leo Bergman
@lbergman
aha...great...will try that out!