View - Atileon/OC-p8 GitHub Wiki

Overview

View that abstracts away the browser's DOM completely.

function View(template) {
      this.template = template;

      this.ENTER_KEY = 13;
      this.ESCAPE_KEY = 27;
      //Query Selectors on DOM
      this.$todoList = qs('.todo-list');
      this.$todoItemCounter = qs('.todo-count');
      this.$clearCompleted = qs('.clear-completed');
      this.$main = qs('.main');
      this.$footer = qs('.footer');
      this.$toggleAll = qs('.toggle-all');
      this.$newTodo = qs('.new-todo');
   }

It has two simple entry points:

View.bind

  • bind(eventName, handler) -> Takes a todo application event and registers the handler (see Controller)

View.bind

View.render

  • render(command, parameterObject) -> Renders the given command with the options (see Controller)

View.render

Previous < Model -------/-------/------- Next > Controller