Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Aug 20 13:06

    FrancisBourre on 1.0.0-alpha.8

    (compare)

  • Aug 20 13:05

    FrancisBourre on 1.0.0-alpha.8

    (compare)

  • Aug 20 13:04

    FrancisBourre on 1.0.0-alpha.8

    (compare)

  • Aug 20 13:03

    FrancisBourre on 1.0.0-alpha.8

    (compare)

  • Aug 20 13:01

    FrancisBourre on 0.36.0

    (compare)

  • Aug 20 12:59

    FrancisBourre on 0.36.0

    (compare)

  • Aug 20 12:12

    FrancisBourre on 0.36.0

    (compare)

  • Aug 07 07:35

    FrancisBourre on master

    Update to latest travix and fix… (compare)

  • Aug 07 07:35

    FrancisBourre on master

    Update to latest travix and fix… (compare)

  • Aug 07 07:32

    FrancisBourre on master

    Update to latest travix and fix… (compare)

  • Aug 07 07:31

    FrancisBourre on master

    travis unnecessay data removed (compare)

  • Aug 07 06:47

    FrancisBourre on master

    Update to latest travix and fix… (compare)

  • Aug 06 12:44

    FrancisBourre on master

    xenial (compare)

  • Aug 06 12:26

    FrancisBourre on master

    lets do it (compare)

  • Aug 06 12:21

    FrancisBourre on master

    wtf (compare)

  • Aug 06 12:14

    FrancisBourre on master

    another try (compare)

  • Aug 06 12:10

    FrancisBourre on master

    Node 8 to get es6 (compare)

  • Aug 06 09:44

    FrancisBourre on master

    install travix 0.12.2 (compare)

  • Aug 06 09:25

    FrancisBourre on master

    install travix 0.0.12 (compare)

  • Aug 06 08:22

    FrancisBourre on master

    back in time to travix 0.12.2 t… (compare)

St3veV
@st3veV
so class that implements IInjectorContainer doesn't actually include injector... it just means that it can be injected into
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
St3veV
@st3veV
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!
all good...nice...thanks again guys!
Laurent Deketelaere
@aliokan
your are welcome!
m0rkeulv
@m0rkeulv

Anyone here who can help me with a hexInject problem?
i am trying add numeric values to my injector, and from what i understand from the 2017 summit video i am supose to use "new Dependency" to achive this, but i cant get it to compile.

import hex.di.Injector;

using hex.di.util.InjectorUtil;

class Main extends Sprite {

public static var injector:Injector = new Injector();
...
private function setupScreen():Void{
injector.mapDependency(new Dependency<UInt>(800), "screen.width");
}
....
}
Executing task: lime build flash -debug --connect 6000 <
Source/Main.hx:92: characters 3-68 : Uncaught exception Cannot call null
Source/Main.hx:24: lines 24-129 : Defined in this class
The terminal process terminated with exit code: 1

line 92 is the injector.mapDependency line
line 24 is the class... line
(Using Haxe 4 preview 4, and HexInject 1.0.0-alpha.4)

m0rkeulv
@m0rkeulv

I have also tried different other combinations:
like:

injector.mapDependencyToValue(new Dependency<UInt>(), WIDTH);
injector.mapDependency(new Dependency<UInt>(),"screen.height").toValue(HEIGHT);

but these give invalid dependency errors:

C:/HaxeToolkit/haxe/lib/hexinject/1,0,0-alpha,4/src/hex/di/util/InjectorUtil.hx:101: characters 3-51 : Called from here
Context.error( "Invalid dependency", clazz.pos );
m0rkeulv
@m0rkeulv

hm.. it looks like all my trouble has to do with the language server messing up macros and caching them wrong or something, i finally manged to get it working now using

injector.mapDependencyToValue(new Dependency<UInt>(), WIDTH,"screen.width");
injector.mapDependencyToValue(new Dependency<UInt>(), HEIGHT, "screen.height");

Visual code still highlight these lines as problems, but at least now it compiles :)

MIchael Solomon
@mikicho
Does hexmachina development continue?
Marcelo Serpa
@fullofcaffeine
Seems so, there has been some activity this year: https://github.com/DoclerLabs/hexMachina