These are chat archives for canjs/canjs

17th
May 2017
Gira Minus
@gKreator
May 17 2017 04:06
init_options.on( 'csrf', function( ev, newVal, oldVal ){
console.log( newVal );
});
any reason why that wont work?
init_options comes from a model/ajax call
image.png
Jeroen Cornelissen
@jeroencornelissen
May 17 2017 09:04
@chasenlehara What do mean with “point to its parent instance”? How would you implement this?
Viktor Busko
@Lighttree
May 17 2017 12:55

Guys what is the correct way to detect that I have compute, but not plain value (like string) ?
I was doing this:

    return prop.name === 'compute' ? prop() : prop;

But found out that there is no name in compute in IE11 at least.

Brad Momberger
@bmomberger-bitovi
May 17 2017 14:14
@Lighttree use prop.isComputed
@gKreator are you asking about the connection? (You've shown init_options and InitOptions which may not be the same thing). Connections don't accept event bindings, to the best of my knowledge
Gira Minus
@gKreator
May 17 2017 17:19
Init_options is the result data, ill show more when i get home
The problem is i set the data twice and the on never fires, probably because im doing init_options = data; which doesnt trigger child property set events?
Brad Momberger
@bmomberger-bitovi
May 17 2017 17:22
Right, that can't work because that's not setting a property, just setting a variable in context. if data is a set of properties to set on init_options, use init_options.set(data)
Adam L Barrett
@BigAB
May 17 2017 21:26

Has anyone ever had a issue, where somethign wasn't updating, and just by adding a "setter", that does nothing really:

filters: {
  set(newVal) {
    return newVal;
  }
},

...somehow fixes it? I am baffled. If anyone has any ideas what coud cause this and why it is fixed by this please let me know what you think

Brad Momberger
@bmomberger-bitovi
May 17 2017 21:30
DefineMap?
Sounds like what's happening is you were using an unsealed DefineMap, you set a value that wasn't defined using =, and therefore no observation was added for the property.
once you set a setter, that included the definition at init time, and you get Observations then.
Adam L Barrett
@BigAB
May 17 2017 21:34
Actually we're using 2.3
Chasen Le Hara
@chasenlehara
May 17 2017 21:51
@BigAB I don’t think I’ve ever seen that kind of issue before. I’m wondering if you can narrow it down to a small example.
Adam L Barrett
@BigAB
May 17 2017 21:59
Yeah, if I could do tht I would probably see the issue. I was just hoping for a hint in the right direction. Well, I'll let you know if I find anything, but I am sure it's probably similar to what Brad mentioned, somwhere is reading a value without attr or something so there is nothing being "observered" I'll bet.
Chasen Le Hara
@chasenlehara
May 17 2017 22:03
Hm yeah could be that :/