JSFiddle - React, Tailwind, and code Playground
by qhoc
HTML
<script src="https://raw.github.com/documentcloud/underscore/1.4.2/underscore.js"></script>
<script src="https://raw.github.com/documentcloud/backbone/0.9.2/backbone.js"></script>
JavaScript
var FakeAjax = Backbone.Model.extend({
field1: "empty 1",
field2: "empty 2"
});
var FakeAjaxCollection = Backbone.Collection.extend({
model: FakeAjax,
/*url: function() {
return [
{field1: "test 3a", field2: "test 4b"},
{field1: "test 4a", field2: "test 4b"}];
},*/
url: function() { return true;},
parse: function() {
return [
{field1: "test 3a", field2: "test 4b"},
{field1: "test 4a", field2: "test 4b"}];
},
initialize: function() {
console.log(this);
this.fetch({add: true});
console.log(this);
}
});
var bootstrap = [
{field1: "test 1a", field2: "test 1b"},
{field1: "test 2a", field2: "test 2b"}];
var fakeAjax = new FakeAjaxCollection(bootstrap);