loading js files using requirejs

This commit is contained in:
floydpraveen
2013-08-17 03:29:44 +05:30
parent 6ac328dd44
commit e7e4253bfc
10 changed files with 1435 additions and 47 deletions
+19 -7
View File
@@ -1,8 +1,18 @@
var app = app || {};
define(
['jquery',
'backbone',
'collections/list',
'views/task'
],
(function() {
function(
$,
Backbone,
List,
TaskView
) {
app.ListView = Backbone.View.extend({
var ListView = Backbone.View.extend({
el: $("#main .children"),
@@ -11,7 +21,7 @@ var app = app || {};
},
initialize: function() {
app.Tasks = this.collection = new app.List();
Tasks = this.collection = new List();
this.collection.fetch();
this.listenTo(this.collection, 'add', this.renderTask);
},
@@ -23,7 +33,7 @@ var app = app || {};
},
renderTask: function(task) {
var taskView = new app.TaskView({
var taskView = new TaskView({
model: task
});
var a = taskView.render();
@@ -34,6 +44,8 @@ var app = app || {};
console.log(a.$input.prop('selectionStart'));
}
});
});
}());
return ListView;
});