jeudi 23 août 2018

How to manage multiple views in a single page with JavaScript?

I am developing a single page application and trying to grasp MVC, MV* structure with vanilla JavaScript. At the moment I have a page that includes a lot of functionality and events. There are some parts of the page that needs to be dynamically rendered separately. Those parts have to interact with each other and a single Model. Creating a single View class for this page seems like it would make it very heavy.

enter image description here

My question is how do I best handle this kind of structure so that the code would be clean, clear and easy to test? Should I create a View for each Part in a page? Should I have those page parts interacting with each other or should they interact through a single controller, presenter? Or should they be working through the single View as some sort of partials?

Please provide some code examples in JavaScript if possible. Thank you..

Aucun commentaire:

Enregistrer un commentaire