Wrapping Up

We have seen how CanJS offers a really nice way of structuring a JavaScript application into models, views, and controllers. Models are not just data containers; they drive the application by signaling changes to other parts of the application and by synchronizing with the server. Views, with the simplicity of the Mustache syntax, are easy to read, and they automatically update themselves to reflect model changes. Controllers combine models and views into components that handle UI events.

CanJS’s Strengths

CanJS gives an excellent balance of functionality and transparency. That is, you get great features without sacrificing clarity: your code remains straightforward JavaScript, with no black magic going on.

The library is lightweight ...

Get Seven Web Frameworks in Seven Weeks now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.