JSFiddle - React, Tailwind, and code Playground
HTML
<script src="http://underscorejs.org/underscore-min.js"></script>
<script src="http://backbonejs.org/backbone-min.js"></script>
CSS
body {
margin: 10px;
font: 13px/1.3 Arial;
}
JavaScript
var collection = new (Backbone.Collection.extend({
url : 'https://api.twitter.com/1/statuses/user_timeline.json?screen_name=vpetrychuk&count=9',
comparator: function(post) {
return +new Date(post.get('created_at'));
}
}));
var view = new (Backbone.View.extend({
el : document.body,
collection : collection,
initialize : function () {
this.listenTo(this.collection, 'sync', this.render);
},
render : function () {
var html = [];
this.collection.each(function (model) {
html.unshift('<div>' + model.get('created_at') + '</div>');
});
this.$el.prepend(html.join(''));
}
}));
collection.fetch({dataType:'jsonp'});