These are chat archives for canjs/canjs

22nd
Apr 2016
dylanrtt
@dylanrtt
Apr 22 2016 00:44
@chrischrischris sounds like a bug
Adam L Barrett
@BigAB
Apr 22 2016 01:46

If anyone ever runs into this issue, this is just an FYI:
If you want to turn a can.Map into JSON, and you need the derived values (like using get in the define) to be included use .serialize() not .attr() as attr does not serialize the getter values.
https://jsbin.com/silexu/2/edit?js,output

Hope this helps someone save some time.

Raghu9972
@Raghu9972
Apr 22 2016 05:27

Hi, I just upgraded my CanJS version to the latest. I'm seeing some issues with the can.List.sort().Now, I can't use can.List.sort(comparator) for sorting the list only once (as I don't want to call the comparator when the list changes). I observed that the can.List.sort(comparator) will work the same way as the previous can.List.prototype.sort plugin now and will sort it automatically whenever there is a change in the can.List

Lets say:

var cart = new can.List([
    { title: 'Bread', price: 4.00 },
    { title: 'Butter', price: 3.50 },
    { title: 'Juice', price: 3.05 }
]);

cart.sort('price');     
cart; // [Juice, Butter, Bread]

cart.push({ title: 'Jam', price: 3.25 });

Previously:
cart; // [Juice, Butter, Bread, Jam] ---> Jam at the last

Now:
cart; // [Juice, Jam, Butter, Bread] ---> Jam is sorted with the list

How can I make can.List.sort() to work as static sort(i.e comparator should not be called for can.List changes)?
I used cart.removeAttr('comparator'); as a workaround to remove the bindings. I couldn't find a better way.

Justin Meyer
@justinbmeyer
Apr 22 2016 16:24
Awwww snap! @pYr0x closing issues like a BEAST! canjs/canjs#1987
Julian
@pYr0x
Apr 22 2016 16:31
?
do we not have a new can-fixture?
Mohamed Cherif Bouchelaghem
@cherifGsoul
Apr 22 2016 16:46
<div type="text/stache" can-autorender>
          <can-import from="pa/login/login">
            <pa-login></pa-login>
          </can-import>
        </div>
dosent render the custom tag
Kevin Phillips
@phillipskevin
Apr 22 2016 16:47
This message was deleted
This message was deleted
should that be a script instead of a div?
<script type="text/stache”…
Mohamed Cherif Bouchelaghem
@cherifGsoul
Apr 22 2016 16:48
how? with {{log}}?
Kevin Phillips
@phillipskevin
Apr 22 2016 16:49
I think it’s just because it’s a div
but you would do something like
          <can-import from="pa/login/login”>
            {{#if isResolved}}
               <pa-login></pa-login>
             {{/if}}
          </can-import>
Julian
@pYr0x
Apr 22 2016 16:51
canjs/canjs#2336
Justin Meyer
@justinbmeyer
Apr 22 2016 16:52
@pYr0x we do ... that was a complement
Julian
@pYr0x
Apr 22 2016 16:52
@cherifGsoul i think we just thought about that
Mohamed Cherif Bouchelaghem
@cherifGsoul
Apr 22 2016 16:52
but it should works also inside a div
WARN: can/view/scanner.js: No custom element found for pa-login
Julian
@pYr0x
Apr 22 2016 16:52
@justinbmeyer ohh ok.. i thought it was "not a complement" ;)
Kevin Phillips
@phillipskevin
Apr 22 2016 16:53
@cherifGsoul oh, if it should work with a div I’m not sure. I wouldn’t have expected that to work.
Julian
@pYr0x
Apr 22 2016 16:53
i think {{#if isResolved}} is needed
Kevin Phillips
@phillipskevin
Apr 22 2016 16:54
so this should work <div type='text/stache' can-autorender ...
?
Julian
@pYr0x
Apr 22 2016 16:54
hmm good question ;)
Kevin Phillips
@phillipskevin
Apr 22 2016 16:54
oh, I guess it is in the docs
Julian
@pYr0x
Apr 22 2016 16:55
@justinbmeyer when do you have time to talk about can-connect?
Justin Meyer
@justinbmeyer
Apr 22 2016 17:05
in 15 min
Mohamed Cherif Bouchelaghem
@cherifGsoul
Apr 22 2016 17:09
@phillipskevin @pYr0x thank you
@phillipskevin it works inside a div also
Kevin Phillips
@phillipskevin
Apr 22 2016 17:10
yeah, saw that in the docs
good to know
learn something new every day
Mohamed Cherif Bouchelaghem
@cherifGsoul
Apr 22 2016 18:12
@pYr0x yes we have talked about it, but how to know static import from dynamic import?
Julian
@pYr0x
Apr 22 2016 18:55
@cherifGsoul matthew postest a exmaple... he explain the static and dynamic import
Julian
@pYr0x
Apr 22 2016 19:04
@cherifGsoul dont know if you notice in the hangout, the downloader for canjs will be removed in canjs 3.0
if you want we can provide a downloader, making in PHP ;)
know justin dont like PHP, but i think we dont have to make a build, we can grab the source from the "dist" folder form every module
if you like that we can lump together
Mohamed Cherif Bouchelaghem
@cherifGsoul
Apr 22 2016 19:50
@pYr0x do you mean the custom download on canjs.com?
Julian
@pYr0x
Apr 22 2016 19:50
yes
Mohamed Cherif Bouchelaghem
@cherifGsoul
Apr 22 2016 19:53
ok we will talk about it someday
Mohamed Cherif Bouchelaghem
@cherifGsoul
Apr 22 2016 20:36
require('can-validate/'); throws node_modules/can-validate/can-validate/index.js 404 (Not Found)
@Macrofig how to use it?
Kevin Phillips
@phillipskevin
Apr 22 2016 20:42
did you try without a slash at the end?
require(‘can-validate’) should load the main from can-validate’s package.json
Mohamed Cherif Bouchelaghem
@cherifGsoul
Apr 22 2016 20:45
I did it now
it works
thank you @phillipskevin
Kevin Phillips
@phillipskevin
Apr 22 2016 20:48
:thumbsup:
Mohamed Cherif Bouchelaghem
@cherifGsoul
Apr 22 2016 20:48
to display error messages a helper is required