Assertfail

All Posts assertfail

View the Blog on GitHub wallymathieu

MVVM Plus Conductor with Knockout js

01 Dec 2011

A better fit in the browser world for knockout than MVC is to have something like a controller. A class responsibe for being an endpoint for routes. This is natuarally coupled with the responsibility of changing between screens. Since controller is such a loaded word, lets simply call it conductor.

That gives you the following components: Model view, view-model and conductor. In order to implement the pattern you can use crossroads js or something similar.

That means that crossroads will route to different conductors that marries view-models and views and sends them off. When the viewmodel changes in such a way that it needs to update the url, it tells the conductor to change the url. Anyone can also ask a conductor to present an object (thus changing the url and updating the screen).

Tags

  • javascript
  • knockout
  • crossroads
  • Comments or errors? Fork post and do a pull request on github