       id:       id
       text:     payload.text
       complete: false
-
     @todos[id] = todo
-    @emit 'change'
+    @emit('change')
 
   onToggleTodo: (payload) ->
     id = payload.id
     @todos[id].complete = not @todos[id].complete
-    @emit 'change'
+    @emit('change')
 
   onClearTodos: ->
     todos = @todos
     Object.keys(todos).forEach (key) ->
       if todos[key].complete
-        delete todos[key]
-    @emit 'change'
+        delete(todos[key])
+    @emit('change')
 
   getState: ->
     todos: @todos


  # Its style will be determined based on the completion state.
  render: ->
    <label>
      <input onClick={@onClick}
             type="checkbox"
             checked={if @props.todo.complete then "checked" else ""}/>
      {@props.todo.text}
    </label>

  # Clicking on a todo item will toggle the completion state.
  onClick: ->

# Rendering the whole component
document.addEventListener 'DOMContentLoaded', (e) ->
  React.render <Application flux={flux} />,
                document.getElementById("react_mountPoint")
