Created
August 27, 2013 18:28
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* | |
* 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