These are chat archives for canjs/canjs

24th
Oct 2018
Julian
@pYr0x
Oct 24 2018 08:54
hey @kevin here i have a demo: https://codepen.io/anon/pen/mzzaXX
i have to problems, maybe you can help me out.
  1. on:input:value:to="todo.name" throw an error because todo is an asynchrone getter and does not have the property name. asynchrone getter does not set the value of the property todo
  1. how can i implement your autosave idea from :point_up: 22. Oktober 2018 22:37
Viktor Busko
@Lighttree
Oct 24 2018 09:55

Guys, Is there such term in CanJS as "representational component" (dumb) ?

For example If I need to render table with data in several places. I can do 2 things:

  1. Create can-component that has no logic, but takes data from bindings.
  2. Create separate .stache file, import it and pass data.

Is there any benefits / drawbacks in using these approaches ? What do you prefer ?

Mohamed Cherif Bouchelaghem
@cherifGsoul
Oct 24 2018 10:03
@Lighttree Choosing the right approach depends on the complexity of your use case, you can start with a stache template and move to a component when things get more complicated
Viktor Busko
@Lighttree
Oct 24 2018 13:57

Guys, I have interesting case...

I'm working on "Toaster" component (for notifications) and want to add 'showToast' method.
But it seems that CanJS has something against this name :D

https://codepen.io/Lighttree/pen/bmQEoj?editors=1011

If you check the example above there are 2 identical functions named showToast and showMessage... and showToast doesn't work in some reason.

Viktor Busko
@Lighttree
Oct 24 2018 14:05

extended example:

https://codepen.io/Lighttree/pen/PyxNNX?editors=1011

I've added another method called toast and showToast started to work, but it calls toast method not showToast method :D

maybe there is something wilth.. to or to + ast
Viktor Busko
@Lighttree
Oct 24 2018 14:13
It doesn't like to + something in name. Just tried showTomessage and got the same issue.
Gregg Roemhildt
@roemhildtg
Oct 24 2018 14:16
That is so weird @Lighttree . I don't have an answer to your question, but I've typically done this instead:
canViewModel('toast-container').addToast(props);
What framework are you making a toast container for?
I have a toast-container for spectre.css, which is somewhat compatible with bootstrap if that's what you're using.
Viktor Busko
@Lighttree
Oct 24 2018 14:18
This is our internal component, it doesn't rely on any external UI kits
Gregg Roemhildt
@roemhildtg
Oct 24 2018 14:19
Gotcha
Kevin Phillips
@phillipskevin
Oct 24 2018 15:46
@pYr0x that seems like a bug to me
it works correctly with value:bind="todo"
odd that on:input:value:to makes it throw
Justin Meyer
@justinbmeyer
Oct 24 2018 16:36
ok-ish quality video: https://youtu.be/t_EWONtG5jg?t=410
Julian
@pYr0x
Oct 24 2018 17:50
@phillipskevin but how do you implement the "autosave" behaviour with value:bind