These are chat archives for canjs/canjs

Oct 2018
I think that video/guide show it ...
I do something like:
<input value:bind="" on:change=""/>
Justin Meyer
Oct 25 2018 01:30
I've started putting up new stache docs too:
Oct 25 2018 07:35
@justinbmeyer i used the approache before too. but i had two problems:
  1. i want to debounce the saving, because i use on:input:value:to="". if i add there is no debouncing. so i need a debounce function inside my VM
  1. if i have 100 items, is it worth to put on every input an event listener? i thought it meight by better so listen on changes on the Model in the VM
Oct 25 2018 07:50
@justinbmeyer good work for updating the stache docs :100:. one more thing i would like to see is basic and simple animation
Viktor Busko
Oct 25 2018 09:28
This "Partial" section refers to {{> expression}} that moved to "Deprecated" section.
It seems that you can't use "partials" without {{> expression}} so probably it shouldn't be in "Deprecated" section ?
Oct 25 2018 09:33
Oct 25 2018 10:48

Hi guys, I have a case when I need to swap 2 elements inside of DefineList, so I did it through the temp variable like this:

let swappedItem = this.viewModel.itemsList[x];
this.viewModel.itemsList[x] = this.viewModel.itemsList[y];
this.viewModel.itemsList[y] = swappedItem;

I see that my list is updated, but I don't see updates on UI where I use {{#each(itemsList, num=index) ....

Do you have any ideas why it doesn't work and what is the appropriate way of doing it?


Oct 25 2018 12:01
yeah this approach works, thanks you!
Justin Meyer
Oct 25 2018 14:15
@pYr0x keep voting for this: canjs/canjs#3864 ... or maybe you could add to the .md file a section showing something like:
<div on:someEvent:by:item="animate()"/>
@pYr0x you could also create a helper that debounces
the best solution would probably be to make a can-connect behavior that works with the instance store .... it would listen to changes on instances and automatically save them if they are in the store
Todo[Symbol.for("can.onInstancePatches")]( function(instance, patches){
  // check if `instance` is in the store
  // debounce an `` call
this would make the behavior "global" for that type
and not make it happen on a specific form or something
for that, I would probably do something in connectedCallback
Justin Meyer
Oct 25 2018 14:20
@Lighttree you can use partials w/o {{> expression }}, this section shows all the ways:
essentially, call expressions can call views now ...
so {{>}} isn't really needed
{{>}} works a bit different, but I think call expressions can do everything