Skip to content

Instantly share code, notes, and snippets.

@davidbrooks
Created February 20, 2014 14:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save davidbrooks/9115564 to your computer and use it in GitHub Desktop.
Save davidbrooks/9115564 to your computer and use it in GitHub Desktop.
My starting point for a standard JS file. Module pattern + jQuery.
var interaction = (function($, window, undefined) {
// These are some global variables.
var example_a = '';
// This is a standard document ready from jQuery. It allows the script to self-start.
$(document).ready(function(){
interaction.init();
});
return {
init: function(){
// These things happen when the page is loaded
interaction.clicks();
},
clicks: function(){
// Watch some clicks here
}
};
})(jQuery, this);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment