These are chat archives for canjs/canjs

Aug 2017
Nico R.
Aug 11 2017 01:12

I'm really confused when declaring observables/variables within a defineMap. I think this is probably a basic topic, but I don't know how it really works.

I've seen (so far) the following syntaxes:

export const ViewModel = DefineMap.extend({
  var1: { type: String, value: 'super' },
  var2: { type: 'string', value: 'super' },
  var3: { value: 'hello', serialize: false},
  var4: 'string',
  var5: 'any',
  var6: '*',


I don't really know their differences and when to use them. As for the serialize option does it mean that ViewModel.serialize() would return everything except from attributes with serialize: false option?


Jeroen Cornelissen
Aug 11 2017 06:31
@nriesco yes, .serialize() doesn’t return serialize: false properties. I see them as “private” properties.
var1 is incorrect and should be Type with a capital T: Type: String or Type: MyCustomMap
var5 & var6 are identical, it means that your var can be anything. If you pass an object to type: ‘*’it stays an object and isn’t converted to a DefineMap.
Aug 11 2017 11:41
Hi all is there any extended guide for algebra?
Kevin Phillips
Aug 11 2017 13:37
@nriesco is the best place to look to learn about the differences
Nico R.
Aug 11 2017 14:31
thanks @phillipskevin it looks like that plus will help me understand (also thanks @jeroencornelissen !)
Kevin Phillips
Aug 11 2017 14:33
there's also if you prefer a video
Justin Meyer
Aug 11 2017 15:31
Justin Meyer
Aug 11 2017 15:39
actually, it will be here: