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.
For example, frontend JS uses
tools.js
for converting between time formats, which is sometimes necessary in backend code too (seeapi/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 (sayshared.js
) would be created to solve this code duplication.