forked from jenimech/Testing-backbone-with-coffescript
-
Notifications
You must be signed in to change notification settings - Fork 0
/
2.js
25 lines (25 loc) · 690 Bytes
/
2.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
(function() {
(function($) {
var ListView, listView;
ListView = Backbone.View.extend({
el: $('body'),
events: {
"click button#add": "addItem"
},
initialize: function() {
_.bindAll(this, 'render', 'addItem');
this.counter = 0;
return this.render();
},
render: function() {
$(this.el).append("<button id='add'>Add list item</button>");
return $(this.el).append("<ul></ul>");
},
addItem: function() {
this.counter++;
return $("ul", this.el).append("<li>hello world" + this.counter + "</li>");
}
});
return listView = new ListView();
})($);
}).call(this);