refactor: separate task creation logic from Kanblendar class
Moved event listener for task button from Kanblendar init method to DOMContentLoaded handler. This change simplifies the Kanblendar class and improves modularity by placing event listening logic closer to the button initialization. Helps maintain separation of concerns and makes the code easier to manage and test.
This commit is contained in:
parent
cc4989cac4
commit
303258ce10
2 changed files with 3 additions and 3 deletions
|
@ -1,3 +1,5 @@
|
|||
document.addEventListener('DOMContentLoaded', () => {
|
||||
new Kanblendar();
|
||||
const kanblendar = new Kanblendar();
|
||||
const createTaskBtn = document.getElementById('createTaskBtn');
|
||||
createTaskBtn.addEventListener('click', () => kanblendar.openModal());
|
||||
});
|
|
@ -33,7 +33,6 @@ class Kanblendar {
|
|||
}
|
||||
|
||||
init() {
|
||||
this.createTaskBtn = document.getElementById('createTaskBtn');
|
||||
this.kanbanSection = document.getElementById('kanblendar');
|
||||
|
||||
if (this.config.generateModal) {
|
||||
|
@ -44,7 +43,6 @@ class Kanblendar {
|
|||
this.taskForm = document.getElementById('kanblendar-taskForm');
|
||||
}
|
||||
|
||||
this.createTaskBtn.addEventListener('click', () => this.openModal());
|
||||
this.closeModal.addEventListener('click', () => this.closeModalFunc());
|
||||
window.addEventListener('click', (event) => {
|
||||
if (event.target === this.taskModal) {
|
||||
|
|
Loading…
Reference in a new issue