Gist 7657226
Cranium demonstrates a minimalist MVC implementation, showing how a model, view, and controller interact to update the DOM. The example uses Underscore.js for templating and utility functions, plus Cranium's own `Events`, `Model`, `View`, and `Controller` APIs. A counter model increments on button clicks, triggering the view to re-render its `<h1>` with the new value via `template` and `innerHTML`. A separate todo model demonstrates `set` and `get` with a checkbox, where a click event toggles completion and re-renders the view.
AI-generated descriptionCranium is a minimalist MVC implementation I wrote to demonstrate how a developer might write their own MVC library within 20 minutes. The purpose of this exercise is to better appreciate what solutions like Backbone.js provide you out of the box.
You may use jQuery and Underscore (or lo-dash) for your implementation.
Note: This code is released strictly for educational purposes and should not be used in production. If you are searching for an MV* framework, TodoMVC.com may help with your selection process.