These are chat archives for canjs/canjs

4th
May 2016
Sunil George
@georgesunil81
May 04 2016 02:47
@gsmeets @phillipskevin thanks for your insights on this. Will check to see if I have 2 versions of jquery on the page. I believe I don't since I only am importing jquery once on the page using define.
I am also importing can (ver 3.0) using define, but I believe the new can version does not install jquery as a dependency.
Kevin Phillips
@phillipskevin
May 04 2016 02:52
I think it still does
it won’t eventually, but it looks like it still does now
Sunil George
@georgesunil81
May 04 2016 02:57
Thanks @phillipskevin for the inputs, I will check. But, I think can.ajaxprefilter will work for what I am trying to do. Thanks for your help there.
Kevin Phillips
@phillipskevin
May 04 2016 02:57
ok, sounds good
Guido Smeets
@gsmeets
May 04 2016 08:45
what's the proper way to bind a component's event to a method on a sibling in 2.3? (is there even a way to do that?)
or should I just expose the sibling's viewModel to the parent, and call methods directly on it?
Guido Smeets
@gsmeets
May 04 2016 08:57
related question, what is the "references scope" in 2.3? That term is coined a few times, but I can't find a page describing the concept
Guido Smeets
@gsmeets
May 04 2016 09:04
that still doesn't explain what that scope is
is it just some extra scope that's not accessible from the parent component? i.e. it's a view-only scope
Gregg Roemhildt
@roemhildtg
May 04 2016 18:52

Is it possible to use the define plugin to define toString methods on properties? Like pythons __repr__ method on a class. For example:

myMap.attr('myProper') //returns 'an_identifier'

but using myMap.myProper in a stache template might return a more readable 'An Identifier'

Julian
@pYr0x
May 04 2016 18:56
what about using a helper in stache
Matthew Phillips
@matthewp
May 04 2016 18:56
Not to string, but there is serialize
what is the purpose of the toString?
what is toStringing it?
Gregg Roemhildt
@roemhildtg
May 04 2016 18:58
It would be really cool to have the template display the toString value of the property, while the value of the property might be something else. A helper would do it, yes.
The template would be calling the toString or whatever its called. Does a stache template call the serialize method on the property?
Just a thought, its definitely already possible with helpers, or even using another property with a getter. I guess this would just define a specific properties display.
Gregg Roemhildt
@roemhildtg
May 04 2016 19:33
@matthewp after looking into it, it seems like this is exactly what the serialize is for. But is it possible to get the serialized value of a property from a stache template?
dylanrtt
@dylanrtt
May 04 2016 19:59
@gsmeets the references scope is private to the template/file so the view model cannot access it, and scope reads within child components do not bubble to it. It's great for sibling communication. Example:
<my-foo {^.}="*foo" />
<my-bar (some-event)="*foo.someMethod()" />
Guido Smeets
@gsmeets
May 04 2016 21:46
Aye, that's precisely what I need
Already figured it out by viewing the source code :) oh well, that sold the deal to my manager, I can upgrade to 2.3 this iteration
Kevin Phillips
@phillipskevin
May 04 2016 22:10
Nice