Backbonejsのsyncエミュレーター設定の確認
by kazu69
HTML
<!DOCTYPE HTML>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Backbone + sinon simple tests</title>
<script src="http://code.jquery.com/jquery-1.7.2.min.js" type="text/javascript"></script>
<script type="text/javascript" src='http://documentcloud.github.com/underscore/underscore-min.js'></script>
<script type="text/javascript" src='http://documentcloud.github.com/backbone/backbone.js'></script>
<script type="text/javascript">
// BackBone Model
var model;
var __hasProp = Object.prototype.hasOwnProperty, __extends = function(child, parent) {
for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; }
function ctor() { this.constructor = child; }
ctor.prototype = parent.prototype;
child.prototype = new ctor;
child.__super__ = parent.prototype;
return child;
};
model = (function() {
__extends(model, Backbone.Model);
function model() {
model.__super__.constructor.apply(this, arguments);
}
return model;
})();
Backbone.emulateHTTP = true;
Backbone.emulateJSON = true;
this.Model = new model();
this.Model.url = '/echo/html/'
this.Model.id = 2
this.Model.set({
data: {
html: "<p>Text echoed back to request</p>" + "<script type='text/javascript'>$('target').highlight();<\/script>",
delay: 3
}
});
this.Model.save()
console.log(this.Model.save())
</script>
</head>
<body>
</body>
</html>