< documentation
Plugins
Extension Points
app/boot/ 1.0.x
usage
Booting your application is an simple, and really just an extension of the jQuery document ready event handler making use of the $.boot
The only thing you need to focus on with a boot strapping process is selecting your environment, triggering the boot process, and optionally include any additional setup steps that are required for your application.
options
In general there may be no difference between a client.js and server.js boot file, but generally we know from experience that there are different environmental setting we have to have for each, so the convention has kept it easy enough to help us remember where we are working. (It can be easy to forget you are working with jquery-claypool!)
examples
The general structure of a boot file, client or server is usually like the following:
jQuery.noConflict(); (function($){ //A static logger for any initialization routines we might add here var log = $.logger("Site"); //Select an environment //The environments are described in environments.js try{ $.env('defaults', "dev.server"); //$.env('defaults', "appengine.server"); }catch(e){ log.error("Environmental selection is invalid!").exception(e); } $(document).ready(function(){ log.info("Initializing Application"); $.boot(function(){ //you can do additional initialization here log.info("Successfully Initialized Application"); //preload all application data $.$('#docsModel').get(); $.$('#releasesModel').get(); $.$('#newsModel').get(); $.$('#eventsModel').get(); $.$('#examplesModel').get(); log.info("Successfully Preloaded Caches"); }); }); })(jQuery);
Project
- app
- app/boot
- app/boot/client.js
- app/boot/server.js
- app/configs
- app/configs/config.js
- app/configs/environments.js
- app/configs/filters.js
- app/configs/logging.js
- app/configs/routes.js
- app/controllers
- app/controllers/example.js
- app/models
- app/models/example.js
- app/services
- app/services/example.js
- app/templates
- app/templates/example.js
- app/views
- app/views/example.js
- index.html
Guides
This guide is applicable to both the jquery-claypool client and server application frameworks. Where the two differ functionally the documentation will provide notes and examples of usage in each environment.