Commit 983bd1b1 authored by Pascal Hartig's avatar Pascal Hartig

ts+backbone: Fixed syntax, extracted constant

parent 154f4f70
...@@ -178,6 +178,8 @@ class TodoView extends Backbone.View { ...@@ -178,6 +178,8 @@ class TodoView extends Backbone.View {
model: Todo; model: Todo;
input: any; input: any;
static ENTER_KEY:number = 13;
constructor (options? ) { constructor (options? ) {
//... is a list tag. //... is a list tag.
this.tagName = 'li'; this.tagName = 'li';
...@@ -200,7 +202,7 @@ class TodoView extends Backbone.View { ...@@ -200,7 +202,7 @@ class TodoView extends Backbone.View {
this.model.bind('change', this.render); this.model.bind('change', this.render);
this.model.bind('destroy', this.remove); this.model.bind('destroy', this.remove);
} }
w
// Re-render the contents of the todo item. // Re-render the contents of the todo item.
render() { render() {
this.$el.html(this.template(this.model.toJSON())); this.$el.html(this.template(this.model.toJSON()));
...@@ -227,7 +229,7 @@ w ...@@ -227,7 +229,7 @@ w
// If you hit `enter`, we're through editing the item. // If you hit `enter`, we're through editing the item.
updateOnEnter(e) { updateOnEnter(e) {
if (e.keyCode == 13) close(); if (e.keyCode == TodoView.ENTER_KEY) close();
} }
// Remove the item, destroy the model. // Remove the item, destroy the model.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment