These are chat archives for canjs/canjs

4th
Apr 2017
Chasen Le Hara
@chasenlehara
Apr 04 2017 00:03
@sszabolcs I would file it here: https://github.com/canjs/canjs/issues
Removing references to other modules (like can.Model) is helpful to us for confirming where the issue is; if can.Model isn’t in the code and the memory leak doesn’t happen, then we can pretty safely assume it’s not causing the issue.
With that JS Bin, it could be in model, fixture, map, component, stache, definemap, or elsewhere… narrowing that down to just component, define/map, and stache would be helpful.
I’m happy to help if you need it. We really appreciate the issues you’ve been filing. :)
Szabolcs Schmidt
@sszabolcs
Apr 04 2017 08:26
@chasenlehara Ok. I'll file it and will try to narrow down the JS Bin to only use the minimal number of modules.
I'm glad you appreciate the filing, I really enjoy this co-work :smile:
alexey1986
@alexey1986
Apr 04 2017 12:44
Please help me with following question: how I can call some method from child component? How I can to do external methods by analogy with the module pattern? canjs v.2.2.9
Szabolcs Schmidt
@sszabolcs
Apr 04 2017 12:53
You can dispatch events on a component and can listen for that event on the parent: doc
alexey1986
@alexey1986
Apr 04 2017 12:58
thanks
Szabolcs Schmidt
@sszabolcs
Apr 04 2017 14:20
@chasenlehara I've filed an issue with the modified JS Bin and tried to give all the information you requested: canjs/canjs#3147
Chasen Le Hara
@chasenlehara
Apr 04 2017 17:37
Sweet, thank you @sszabolcs
lmagarian
@lmagarian
Apr 04 2017 20:23

I have a list of flags in a ViewModel that I'm trying to get live bound in stash but having trouble…

var ViewModel = DefineMap.extend({

"flags": { "value": new DefineList() },
"toggleFlags": function ( index ) {
this.flags[index] = !this.flags[index];
},
...

And in the corresponding stash file:

{{#if flags[%index]}}
<tr>
<td colspan="5">...
{{/if}}

The problem is that the flags are only checked when the page 1st renders. I have a button successfully calling toggleFlags updating the value to true or false, but the #if statement doesn't notice that the value has changed.

Chasen Le Hara
@chasenlehara
Apr 04 2017 20:55
Hi @lmagarian, is this JS Bin representative of the issue you’re seeing? http://jsbin.com/gopimuxare/1/edit?html,js,console,output
lmagarian
@lmagarian
Apr 04 2017 20:59
@chasenlehara close. I made a small mod: http://jsbin.com/vojalemuro/1/edit?html,js,console,output
Chasen Le Hara
@chasenlehara
Apr 04 2017 21:03
Yeah, I fixed that :)
We don’t recommend passing an object to value because it’ll be reused by all instances of that define map, whereas you probably want that list recreated each time a new instance of the view model is instantiated.
We discussed this on the forums recently: http://forums.donejs.com/t/can-define-value-vs-value/581
lmagarian
@lmagarian
Apr 04 2017 21:10
@chasenlehara so if I use your original jsbin and then check one of the checkboxes, I'd expect the list of numbers below to change, but it doesn't
Chasen Le Hara
@chasenlehara
Apr 04 2017 21:13
Yeah, looks like a bug to me. I’m going to file an issue for it.
canjs/can-stache#180