JSFiddle - React, Tailwind, and code Playground
by Cody Lindley
HTML
<script src="https://getfirebug.com/firebug-lite-debug.js"></script>
<!-- functional programming utility library -->
<script src="http://cdnjs.cloudflare.com/ajax/libs/lodash.js/1.3.1/lodash.underscore.js"></script>
<!-- DOM & XHR utility -->
<script src="http://cdnjs.cloudflare.com/ajax/libs/jquery/2.0.2/jquery.min.js"></script>
<!-- Backbone.js -->
<script src="http://cdnjs.cloudflare.com/ajax/libs/backbone.js/1.0.0/backbone-min.js"></script>
CSS
iframe {
height:263px !important;
}
JavaScript
//extend the A object with Backbone.Events methods
var A = _.extend({name:'A'}, Backbone.Events);
var B = {name:'B'};
//when the event on A is called, set the callbacks context (i.e. this) to B
A.on('sayMyName', function () {
console.log(this.name);
}, B);
//trigger sayMyName
A.trigger('sayMyName'); //logs B because we adjusted context of callback