TomasStolp / real-time-web-1920

Real-Time Web @cmda-minor-web · 2019-2020
https://cmda-minor-web.github.io/real-time-web-1920/
MIT License
0 stars 0 forks source link

Seperate client logic in seperate scripts #16

Closed TomasStolp closed 4 years ago

TomasStolp commented 4 years ago

I was thinking about the architecture on the client side. First I thought, okay I can bundle this and that to reduce requests to the server.

But I found out that there's a lot of logic I need seperated. So for now I splitted up the socket events in two scripts. The script for the visitor and another script for the artist.

And for the template to know which scripts to load, I give it an array of the scripts and then I loop through them at the end of the body.

For additional attribute options on the script tags I can make objects in the array instead of the names of the scripts. That's more elegant, but not really the main goal here. So I can tackle that when I have time left over, which is not gonna happen.