I have a very simple question. How do you load BackboneJS and use it in a module without using requireJS?
I am only using 1 module, so all Backbone view, model and collection will be in that file.
index.html
<!-- libraries 10k zipped-->
<script src='js/libs/underscore-min.js'></script>
<script src='js/libs/backbone-min.js'></script>
<!-- modules -->
<script src='js/game.js'></script>
game.js
window.onload = (function(Backbone){
var Input = Backbone.View.extend({
events: {
'mousedown' : 'handleMouseDown',
'mouseup' : 'handleMouseUp',
},
handleMouseDown: function(){
console.log('mousedown');
},
handleMouseUp: function(){
console.log('mouseup');
}
}),
input = new Input;
return input;
})();
You need to pass Backbone as the parameter since you’re using it in the in params: