Skip to content

Instantly share code, notes, and snippets.

@lisp-ceo
Created August 27, 2013 18:28
Show Gist options
  • Save lisp-ceo/6357197 to your computer and use it in GitHub Desktop.
Save lisp-ceo/6357197 to your computer and use it in GitHub Desktop.
Small-scale web applications often need a good bootstrap for JavaScript. Here's a light-weight bootstrapping script for AOP/Event-driven apps
/**
*
* Site-Wide JavaScript - application-specific
*
* @author James Meldrum
*
* The functionality for each page type is stored
* in a hash of functions to be called by the router.
*
* Frequent use of AOP
* http://en.wikipedia.org/wiki/Aspect-oriented_programming
* and Event-Based Programming
* http://en.wikipedia.org/wiki/Event-driven_programming
*
*/
(function(){
"use strict";
/*
*
* Execute each aspect with a router based on page type
*
*/
var siteAspect = {
'common' : function(){
},
'home' : function(){
},
'photos' : function(){}
};
/*
*
* Two application entry points.
*
* DOMReady fires all subscribed members when the DOM is available for
* manipulation
*
* OnLoad fires once all elements ( including images and iframes ) have been
* loaded
*
*/
// DOMReady
$( document ).ready( function(){
});
// OnLoad
$( window ).load( function(){
});
}());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment