These are chat archives for canjs/canjs

9th
May 2016
Guido Smeets
@gsmeets
May 09 2016 09:42
hmm, I need a reference to a dom node in my component's viewModel, anyone know if it's okay to do that? i.e.:
can.Component.extend({
    [..],
    inserted: {
        this.viewModel.foo = this.element.find( ".foo");
    },
   removed: {
        this.viewModel.foo = null;
    }
});
I'm a bit afraid of mem leaks
Jeroen Cornelissen
@jeroencornelissen
May 09 2016 09:52
@gsmeets I do the same thing…
inserted : {
    this.viewModel.attr(‘element’, this.element);
}
Justin Meyer
@justinbmeyer
May 09 2016 14:33
Yeah, that's fine. I generally define that property's type as "*" then.
Julian
@pYr0x
May 09 2016 19:27
@justinbmeyer @ccummings i see the repo canjs/can-devtools
but i cant get it running
is there a possible installation and usage guide?
Justin Meyer
@justinbmeyer
May 09 2016 20:53
You can add it as a "load unpacked extension"
@ccummings and alexis are working on it this week
Julian
@pYr0x
May 09 2016 20:54
hmm i cant get it working
i getting a error for $.extend is not defined
it seems jquery is not working
or something else
Guido Smeets
@gsmeets
May 09 2016 21:42
can I create an event binding with arguments that are defined only on the child component, not on the parent?
Guido Smeets
@gsmeets
May 09 2016 21:47
or can I somehow dispatch an event on a can.Map with extra parameters that are passed on
dylanrtt
@dylanrtt
May 09 2016 22:09
@gsmeets when you trigger the event (assuming can.trigger), you can pass custom values on the event object and then access them in the binding syntax with %event
http://jsbin.com/jutegemive/edit?html,js,console,output
Julian
@pYr0x
May 09 2016 22:14
@dylanrtt jesus, this is crazy :)
Guido Smeets
@gsmeets
May 09 2016 22:33
@dylanrtt thx
that's slightly better than what I concocted now:
<my-component {^foo}="*foo" {fooEvent}="*otherComponent.setFoo(*foo)" />
and that times three, because I wasn't able to generalize the event parameter
thanks a bundle