Gist 7021205
Cranium, a minimalist MVC library, demonstrates a model-view-controller pattern where a model’s counter state updates a view’s rendered HTML through custom events and Underscore templating. The code shows two controller-driven interactions—an increment button and an alert button—plus a separate todo model with checkbox toggling that re-renders the view. Using Cranium’s `Model.set`, `View.observe`, and `Controller` event bindings, it highlights how user actions trigger model changes, which in turn notify the view to update the DOM. The example also exercises Underscore utilities like `_.pluck` and `_.shuffle` on model collections.
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.