Commit 6a1a87a4 authored by Milan Iliev's avatar Milan Iliev

Refactored addButton into controller

parent 413e57b8
import Task from "./tasks/task.js"
import TaskController from "./tasks/controller.js"
let task_controller = new TaskController()
let addButton = document.querySelector('#add_button')
let main = async () => {
addButton.addEventListener("click", () => {
task_controller.addTask(new Task({done: false, description: "New Task"}))
})
task_controller.refresh()
}
main()
task_controller.refresh()
\ No newline at end of file
......@@ -9,6 +9,11 @@ class TaskController {
this.list_element = document.querySelector("task-list")
this.detail_view = new DetailTaskView(document.querySelector("task-detail"))
this.addButton = document.querySelector('#add_button')
this.addButton.addEventListener("click", () => {
this.addTask(new Task({done: false, description: "New Task"}))
})
}
addTask(task){
......
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