M form MVC
JavaScript
Switch branches/tags
Latest commit 0c67fad Jul 8, 2011 @Gozala Version 0.2.0
Permalink
Failed to load latest commit information.
tests Simplify package layout. Jun 10, 2011
.gitignore Adding node_modules to readme. Jun 10, 2011
History.md Version 0.2.0pre Jul 2, 2011
Readme.md Updating readme Jun 10, 2011
models.js Version 0.2.0 Jul 8, 2011
package.json Version 0.2.0 Jul 8, 2011

Readme.md

models

M form MVC

Install

npm install models

Require

var Model = require('https!raw.github.com/Gozala/models/v0.1.0/models.js').Model

Usage

var Model = require('https!raw.github.com/Gozala/models/v0.1.0/models.js').Model
var Sidebar = Model.extend({
  promptColor: function(value) {
    this.set({ color: value });
  }
})

var sidebar = Sidebar({ color: 'white' })
sidebar.on('change:color', function(event) {
  console.log('color is no longer ' + event.previous + ' it is ' + event.value)
})
sidebar.promptColor('red')