CanJS 2.1 released

This week CanJS 2.1 was released. It's packed with a lot of awesome stuff, and in this blog post I'll go over some of my favorite features. If you want to read the official release blog post, you can find it on the Bitovi blog.

Performance

CanJS 2.1 brings multiple changes that will result in snappier apps. These are:

  • can.stache - Mustache compatible templating
  • lazy event bubbling
  • LazyMap and LazyList

can.stache

can.stache works by building DOM nodes directly instead of creating the string based renderer functions which are later eval-ed. This results in much better performance, while beeing compatible with the current can.mustache.

Lazy event bubbling and LazyMap / LazyList

Lazy event bubbling ensures that events will bubble only if someone is listening to them, and LazyMap / LazyList will only convert its children when they're accessed for the first time. Both of these changes result in the performance improvements, especially with the deeply nested objects.

Define plugin

Define plugin deprecates the can/map/attributes and the can/map/setter plugins by implementing the API which allows you to completely control how an attribute will behave. Read more about it in the documentation.

can.route.map

can.route.map allows you to pass your own instance of can.Map to the can.route. can.route will use it internally to store it's state. It's a pretty small feature, but it will allow much cleaner Application State objects.

These are just some of my favorite features, and if you want to get the whole picture, go and read the official release post.

In my opinion this release packs so much new stuff that it could be easily designated as 3.0 release. In the next few weeks I plan to write a series of posts to show how to use all of this goodness, and generally, how to write clean and maintainable apps with the CanJS

Did you like this article?

If so, subscribe to Retroaktive.me mailing list and get notified when the new stuff gets posted

* indicates required
comments powered by Disqus