These are chat archives for canjs/canjs

5th
Sep 2017
Szabolcs Schmidt
@sszabolcs
Sep 05 2017 06:31
@nriesco The situation is the following: there are two components foo and bar. bar is child component in foo. When something happens in foo - a model is modified - bar needs to update its model, too. I would like to send an event to bar to refresh its model. Thanks for the function binding idea. I'll check it!
Nico R.
@nriesco
Sep 05 2017 13:02
@sszabolcs usually you’ll set most of the binding behavior in the “inserted” event in the child component. There you’ll have access to its viewmodel via this.viewmodel
Then you can either set a property that is linked (via a binding) to the main compoentn foo
kostya.aderiho
@kaderiho
Sep 05 2017 13:18

Hi all, is anyone had a problem with method parseListData in Safari?

I'm calling it in my connection like as:

Priority.connection = connect(
    [realtime, authBehavior, parse, fallThroughCache, constructor, constructorStore, canMap], {
        url: '/pm/v1/priorities',
        Map: Priority,
        List: Priority.List,
        name: 'priority',
        parseListData(response) {
            return { data: response };
        },
        algebra,
        cacheConnection
    });

It works fine for all browsers, but for Safari doesn't work at all

Nico R.
@nriesco
Sep 05 2017 13:19
and within the foo component you can listen to a variable’s changes (I haven’t tried that yet) using something like this: (within the event object):
"{viewModel} myVariable": function() {
  console.log('do something when myVariable changes');
},
either that or you can trigger directly a function calling a child’s function that is binded to a parent’s function
@kaderiho does safari complain about some sort of security issue or it just won’t work? any feedback in the console?
kostya.aderiho
@kaderiho
Sep 05 2017 13:25
So, in parse.js file there is a parseListData method that is not calling in safari, seems that something can't run it exactly in this browser
I'm investigation this, but may be someone saw the same issue
Gregg Roemhildt
@roemhildtg
Sep 05 2017 14:41
I've seen that issue in ios
@kaderiho
I also saw it in an older version of IE
I think it had to do with the order of the prototype chain when behaviors get connected. Super hard to diagnose though, I ended up putting the parse stuff as the first object in the array of behaviors.
seemed to fix it
kostya.aderiho
@kaderiho
Sep 05 2017 14:59
I've tried to put parse at the first object, but getting Cannot read property 'length' of undefined TypeError: Cannot read property 'length' of undefined now :(
Seems that needs to play with order, may be there is some winning combination for myself :)
I guess it should goes after constructor behavior
Gregg Roemhildt
@roemhildtg
Sep 05 2017 15:04
I'm not sure, getting the behaviors in the right order has been tricky for me
Brad Momberger
@bmomberger-bitovi
Sep 05 2017 15:30
@pYr0x I just released a new patch release of can-legacy-view-helpers that includes your PR
Runn Vermel
@runn-vermel
Sep 05 2017 21:17
Hi Guys, a simpler question today: being a newbie - does CanJs have a concept of light dom, and passing html that can be distributed into a component (using the content/slot tags, or equivalent)?
i.e. <customTag><div>light dom content</div></customTag>
Kevin Phillips
@phillipskevin
Sep 05 2017 21:22
yes, it does
Justin Meyer
@justinbmeyer
Sep 05 2017 23:01
@/all Some upcoming event dates: https://forums.donejs.com/t/some-upcoming-events/719
Runn Vermel
@runn-vermel
Sep 05 2017 23:01
thanks @phillipskevin !