JSFiddle - React, Tailwind, and code Playground

by Cody Lindley

HTML

<script src="https://dl.dropboxusercontent.com/u/2026291/backbone/jquery-2.0.2.js"></script>
<script src="https://dl.dropboxusercontent.com/u/2026291/backbone/lodash.underscore.js"></script>
<script src="https://dl.dropboxusercontent.com/u/2026291/backbone/backbone.js"></script>
<script src="https://getfirebug.com/firebug-lite-debug.js"></script>

JavaScript

var contact= new Backbone.Model();

var ContactView = Backbone.View.extend({
    initialize:function(){
        //listen to change event on model
        this.listenTo(contact,'change:firstName',this.render);
    },
    render:function(){console.log('render a change, data changed');}
});

new ContactView();
//change event, fired because we are only listening for firstName
contact.set('firstName','john'); 
contact.set('phone','222-222-2222'); //no change event trigger