For really JS-heavy applications, you should try to mimic Java.
- Have as little JS in your HTML as possible (preferably - just the call to the bootstrap function)
- Break the code into logical units, keep them all in separate files
- Use a script to concatenate/minify the files into a single bundle which you will serve as part of your app
- Use JS namespaces to avoid cluttering up the global namespace:
var myapp = {};
myapp.FirstClass = function() { ... };
myapp.FirstClass.prototype.method = function() { ... };
myapp.SecondClass = function() { ... };
Using all these techniques together will yield a very manageable project, even if you are not using any frameworks.
For really JS-heavy applications, you should try to mimic Java.
- Have as little JS in your HTML as possible (preferably - just the call to the bootstrap function)
- Break the code into logical units, keep them all in separate files
- Use a script to concatenate/minify the files into a single bundle which you will serve as part of your app
- Use JS namespaces to avoid cluttering up the global namespace:
var myapp = {};
myapp.FirstClass = function() { ... }
myapp.FirstClass.prototype.method = function() { ... }
myapp.SecondClass = function() { ... }
Using all these techniques together will yield a very manageable project, even if you are not using any frameworks.
For really JS-heavy applications, you should try to mimic Java.
- Have as little JS in your HTML as possible (preferably - just the call to the bootstrap function)
- Break the code into logical units, keep them all in separate files
- Use a script to concatenate/minify the files into a single bundle which you will serve as part of your app
- Use JS namespaces to avoid cluttering up the global namespace:
var myapp = {};
myapp.FirstClass = function() { ... };
myapp.FirstClass.prototype.method = function() { ... };
myapp.SecondClass = function() { ... };
Using all these techniques together will yield a very manageable project, even if you are not using any frameworks.
For really JS-heavy applications, you should try to mimic Java.
- Have as little JS in your HTML as possible (preferably - just the call to the bootstrap function)
- Break the code into logical units, keep them all in separate files
- Use a script to concatenate/minify the files into a single bundle which you will serve as part of your app
- Use JS namespaces to avoid cluttering up the global namespace:
var myapp = {};
myapp.FirstClass = function() { ... }
myapp.FirstClass.prototype.method = function() { ... }
myapp.SecondClass = function() { ... }
Using all these techniques together will yield a very manageable project, even if you are not using any frameworks.