view.js - niyogakiza/Openclassroom_Project-8 GitHub Wiki

view.js

This view.js file allows us to manage the events on our todo list.

  • We define our view with a template as an argument. There are two keys to add or cancel todos. And the elements of the DOM to which we will apply our events.
  • _removeItem: allows us to remove an item from the list with its id.
  • _clearCompletedButton: is used to manage the display of the clear completed button.
  • _setFilter: is used to manage the filter of the todos displayed.
  • _elementComplete: is used to manage the completion of todos.
  • _editItem: is used to start modifying a todo with its id and title.
  • _editItemDone: allows the modification of a todo after validation.
  • render: is one of the most important of the file, it allows the connection between the commands and the events.
  • _itemId: allows to recover the id of a todo.
  • _bindItemEditDone: handles the events that must occur when modifying a todo.
  • _bindItemEditCancel: manages the events that take place when canceling the modification of a todo.
  • bind: as its name suggests, links event to their handlers.