How much can a complex "single paged" application be?

I am working on a fairly large application with several additional modules. Each of the submodules can have complex functionality with many panels and user interface components. I used to do smaller projects as a one-page application, but this time I was worried that my DOM would not be updated for a long time if the user continued to work in many modules.

When I analyze how Facebook works, I see that it works as a single-page application most of the time. But from time to time it updates the entire DOM with the help of the user (apparently, it is random OR based on the calculation of user activity).

Are they any model or best practice regarding how you can build large applications like a single page without sacrificing DOM performance?

(I'm not looking for coding methods to keep the memory level low, but for a design approach for a general application)

+4
source share
3 answers

There is no shame in updating the page. The application does not have which is strictly one-page.

If you have controls on your page, their actions should remain on this page. But if the user goes to a completely different part of the application, there is no reason why he will not be able to simply go to this particular page.

+7
source

Destroying the DOM nodes or setting innerHTML = '' for a panel that needs to be changed should be fine just before the change. I believe UI elements have destroy or similar functionality.

Also consider disabling all javascript variables involved in the panel functionality that need to be cleared.

+1
source

It is always useful to have a kernel application that controls the life cycle of your modules. And each of your modules will have a well-defined interface, such as launch (), destroy (), etc., or something makes sense. Therefore, when the destroy () function is called, it will call html, as well as a Javascript object that stores application data. Nicholas Zakas has an excellent presentation in a large-scale Javascript application. Hope this helps.

Scalable Javascript Application Architecture by Nicholas Zakas

0
source

Source: https://habr.com/ru/post/1442257/


All Articles