Skip to content

Instantly share code, notes, and snippets.

@Phoen1x84
Last active February 27, 2016 21:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Phoen1x84/fde1c95de507441416dd to your computer and use it in GitHub Desktop.
Save Phoen1x84/fde1c95de507441416dd to your computer and use it in GitHub Desktop.
Self invoking function - Revealing module pattern
// noConflict mode
jQuery.noConflict();
var app = app || {};
app.myFunction = (function ($, undefined) {
// do all the things
var init = function(){
if (!$('body').hasClass('page-editor')) { // custom class added to the body to check for page editor
console.log('Hi friends!');
}
};
return {
init: init
};
})(jQuery);
jQuery(document).ready(function () {
app.myFunction.init();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment