Thursday, 14 June 2018

026 BackboneJS Backbone.noConflict

Backbone.noConflict

Get the Backbone object back to its original value.  
 
Syntax : var backbone = Backbone.noConflict()




<!DOCTYPE html>
<head>
<title>Router Extend Example</title>
<script src="https://code.jquery.com/jquery-2.1.3.min.js" type="text/javascript"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.8.2/underscore-min.js"
type="text/javascript"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/backbone.js/1.1.2/backbone-min.js"
type="text/javascript"></script>
</head>
<script type="text/javascript">

Backbone.emulateHTTP = true;

Backbone.sync = function (method, model)
{
document.write(method + ": " + JSON.stringify(model) + "");
model.set('id', 1);
};

var student = new Backbone.Model
({
name: "john",
class: 4
});

student.save();
student.set({ name: "john2" });
student.save();
student.destroy();

var noConflikObj = Backbone.noConflict();

document.write(noConflikObj.VERSION + "");
</script>


Output :


create: {"name":"john","class":4}
update: {"name":"john2","class":4,"id":1}
delete: {"name":"john2","class":4,"id":1}
1.1.2



No comments:

Post a Comment

বাঙালির বেড়ানো সেরা চারটি ঠিকানা

  বাঙালি মানে ঘোড়া পাগল | দু একদিন ছুটি পেলো মানে বাঙালি চলল ঘুরতে | সে সমুদ্রই হোক , পাহাড়ি হোক বা নদী হোক। বাঙালির ...