📜 ⬆️ ⬇️

MVC in javascript

I'm here for my site for a long time already slowly making the engine. The concept has changed many times, so it will probably be difficult for me to explain how it works. With this approach, I usually get CMS, and then it turned out MVC in JavaScript =)

Here is the HTML code:
<joos:m codebase="JooS_Application" ready-state="uninitialized">
<joos:m codebase="JooS_RPC_Methods" schema-default="schemas.methods" ready-state="uninitialized"></joos:m>
</joos:m>


The joos: m tag is a javascript component, the codebase attribute is a component class, ready-state is the state of the component (there are uninitialized, loading, loaded, interactive, complete) attributes schema- * are the names of the schema templates to be loaded from the server.

After the page loads, the component classes themselves and all the required schemas are loaded (here: JooS_Application , JooS_RPC_Methods and schema " schemas.methods ")

The JooS_RPC_Methods class component in the loading state loads the data (used by Json-RPC) and displays it inside itself using the loaded schemas.methods template. Further in the loaded state, the component hangs some events on the resulting HTML elements.
')
Turns out that:
Model - server RPC procedures
View - Advanced JsonML templates that come from the server
The controller is the component itself.

Here is the link: joos.nnov.ru
If it is interesting to look in more detail, then it’s best to do it in the Net FireBug tab on this page: joos.nnov.ru/?debug=1

Cross post from here: covex-nn.ya.ru/replies.xml?item_no=250

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


All Articles