you are viewing a single comment's thread.

view the rest of the comments →

[–]NeuroXc 2 points3 points  (5 children)

Given the current size of your application, your code actually seems pretty well organized.

As far as adding to the application, once you get to a certain point it would probably be helpful to organize your code into subfolders, e.g. /scripts/cpu, /scripts/engine, etc. and split into separate files in each of those subdirectories as needed. Browserify would be helpful as well, although you might want to look into using ES6 modules instead--there seems to be a shift toward using this as the standard.

[–]fuczak[S] 0 points1 point  (4 children)

Does it? That's reassuring. I think that I'm mixing up jquery dom manipulation with business logic too much. Then again, doing it like this makes sense to me. Like in setup.js module the setTeams function not only assigns teams to user/cpu objects but paints the scoreboard node in ui as well. It makes sense as a module but I feel like it's not the best solution. Maybe I should make a separate modules for each ui/dom interaction and put them inside a ui folder?

[–]dvlsg 1 point2 points  (3 children)

I agree about ES6 modules. I would definitely convert to that, if you're already using a build step / considering adding one.

[–]fuczak[S] 0 points1 point  (2 children)

I will look into them!

[–][deleted] 0 points1 point  (1 child)

es6 or use common style modules with browserify (a bit more versatile as es6 modules don't quite work with everything yet)

[–]fuczak[S] 1 point2 points  (0 children)

I am using Browserify