JSFiddle - React, Tailwind, and code Playground
HTML
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/underscore.js/1.6.0/underscore-min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/backbone.js/1.1.2/backbone-min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/handlebars.js/2.0.0-alpha.1/handlebars.min.js"></script>
<script src="https://rawgithub.com/FormidableLabs/handlebones/master/handlebones.js"></script>
<button id="a">Show View A</button><button id="b">Show View B</button>
JavaScript
var LoggingView = Handlebones.View.extend({
initialize: function () {
this.listenTo(this, "all", function (eventName) {
$("body").append(this.name + ': ' + eventName + '<br>');
});
}
});
var layoutView = new Handlebones.LayoutView();
$(function () {
$("button#a").click(function () {
var viewA = new (LoggingView.extend({
name: 'A',
template: Handlebars.compile("A")
}))();
layoutView.setView(viewA);
});
$("button#b").click(function () {
var viewB = new (LoggingView.extend({
name: 'B',
template: Handlebars.compile("B")
}))();
layoutView.setView(viewB);
});
});
layoutView.appendTo(document.body);