These are chat archives for canjs/canjs

22nd
Oct 2015
mpal9000
@mpal9000
Oct 22 2015 10:44
Hello, is there any syntax highlighting package for sublime and other editors for *.component files of donejs?
Mihai Fantana
@fantanamihai
Oct 22 2015 13:33
hi guys. canjs 2.2.9. the thing is that in our old app we are using models with get/set per attributes a lot. I found out that there is can/map/setter. Is there any reason no 'can/map/getter' is available ?
I know about 'define', but before that, what was the way to have a getter in a model?
David Luecke
@daffl
Oct 22 2015 14:42
@mpal9000 I usually just set it to HTML or HTML + Handlebars if your editor supports it. If it can't do <viewmodel> tags then you can also fall back to <script type="viewmodel"> to get JS highlighting.
@meconcomputer The way to do getters in 2.2.9 is define. I think it should work together with the setter plugin although it would make sense to eventually migrate (it's much more powerful)
Mihai Fantana
@fantanamihai
Oct 22 2015 14:45
@daffl thanks for the answer. We try to postpone and we will get to define later. How was getter in 2.1?
mpal9000
@mpal9000
Oct 22 2015 14:59
@daffl ok thanks
Justin Meyer
@justinbmeyer
Oct 22 2015 15:12
@meconcomputer you could add a can.compute to the prototype
and that could act like a getter
but please don't do that
use define :-)
migrating your setters should be straightforward
I believe they have the same signature
if you had setFoo: function(...) { ... }
you just change that to
define : {
  foo: {
    set: function(...){ ... }
  }
}