The biggest part of our refactoring revolves around the introduction of the controller layer, the orchestrator of our new version.
Implementing the controller layer
Creating the TodoListController interface
First, let's define our controller interface, TodoListController. Add it underneath the HTMLTodoListView class:
interface TodoListController { addTodo(): void; filterTodoList(): void; removeTodo(identifier: string): void; }
This interface might surprise you because, apart from the removeTodo method, the methods don't accept parameters. The reason for this is that our view will interact with the controller layer by passing signals to it.
To give you an example, when you click on the Add button...