p2r3 / epochtal

Portal 2 tournament framework
https://epochtal.p2r3.com/
GNU General Public License v3.0
8 stars 4 forks source link

Use a shared collection of tools for frontend and backend #51

Open p2r3 opened 4 months ago

p2r3 commented 4 months ago

For example, frontend JS uses tools.js for converting between time formats, which is sometimes necessary in backend code too (see api/leaderboard.js). Other similar duplicated snippets of code exist too - for example, when deconstructing profile logs on client and server.

My proposal is to have a collection of such shared tools exist in one JS file which both the front and back end code can load and repurpose. The existing tools.js file can remain used for client-only actions like tooltips or popups, and a new file (say shared.js) would be created to solve this code duplication.