Awesome q2a theme

In MVC how to join the event through the View and adding it to the Module?

0 like 0 dislike
42 views
Good day!
Actually the whole question in the title, I have a button written in HTML, there is a View and there is a Module with an empty array as the via Controller on click I can add anything to the array module, for example here is my View which returns the number:
export class View { addItem() { let plus = document.querySelector('.plus'); plus.addEventListener('click', () => { let num = document.querySelector('.count').innerHTML; return num; }) } }

Here is my Module with the function addNum, which actually needs to add the number to the array:
export the class Module { constructor() { this.num = []; } addNum(num){ this.num.push(num); } }

And here is Controller:
class Controller { constructor(view, module){ this.view = view; this.module = module; } getNum(){ this.cart.addNum(this.view.addItem()); } }


The problem is that when I call the function getNum controller, it works instantly, I wait for a particular event ?
I hope all clearly explained, thanks!
by | 42 views

1 Answer

0 like 0 dislike
by

Related questions

0 like 0 dislike
1 answer
0 like 0 dislike
3 answers
asked Mar 25, 2019 by Anexroid
0 like 0 dislike
6 answers
0 like 0 dislike
4 answers
110,608 questions
257,187 answers
0 comments
40,796 users