Added components doc in client.md

This commit is contained in:
l_samenv
2024-08-29 15:37:50 +02:00
parent 6ed8529e1b
commit 83e22a2e9f

View File

@ -10,6 +10,12 @@ This function calls the /update route, which will initiate the SSE connexion, re
The calling cascade is initiated with the `nextInitCommand()` function (`SeaWebClientMain.js`), called just after the `loadFirstBlocks()` function. Every response of each command will be treated in the switch statement of the `successHandler()` function (in `SeaWebClientCommunication.js`). Specifically, the content of each block is dynamically created in JS when the response of the different init commands are received.
### Components
A component is composed of a JS file and its CSS file. They are grouped in the folder `client/components`. A component is basically a class that inherits from `HTMLELement`, and implement the method connectedCallback, where the HTML of the component has to be defined. Then, it has to be added to the customElements via the line `customElements.define("<component-name>", <ComponentClass>)`. The component's name has to contain dash, otherwise an error is thrown.
The export popup and the dates popup are considered as components just to separate their code from the rest.
### About updating graphics
- When the server is pushing data, the newly received data is appened to the current curves (on livemode).