Created
August 1, 2012 22:30
-
-
Save tarex/3231274 to your computer and use it in GitHub Desktop.
RequireJS 2 config with jquery , underscore and backbone.js using schim
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require.config({ | |
paths:{ | |
jquery:'libs/jquery/jquery', | |
underscore:'libs/underscore/underscore', | |
backbone:'libs/backbone/backbone' | |
}, | |
shim:{ | |
underscore:{ | |
deps:[], | |
exports:'_' | |
}, | |
backbone:{ | |
deps:['underscore','jquery'], | |
exports:function(){ | |
return Backbone.noConflict(); | |
} | |
} | |
} | |
}); | |
require(['models/todo'],function(TodoModel){ | |
var todo = new TodoModel(); | |
console.log("its working from bootstrap and my name is : "+todo.get('content')); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
define(['jquery','backbone'],function($,Backbone){ | |
var TodoModels = Backbone.Model.extend({ | |
defaults:{ | |
content:'tareq jobayere' | |
}, | |
initialize:function(){ | |
console.log("initialized todo model"); | |
} | |
}); | |
return TodoModels; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment