Created
October 28, 2014 17:35
-
-
Save benjaminsinger/3eefe5377da59098590f to your computer and use it in GitHub Desktop.
This is what a clean JS file looks like -- do it like this in future.
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
// "use strict"; | |
var $home = (function () { | |
var home = {}, // create the 'global local' -- within our primary home function -- app object {} | |
saywhit = "you wot mayte?", | |
isTouch = $('.touch').length, | |
isIE8andBelow = $('.lt-ie9').length, | |
hasCssAnimations = $('.csstransforms').length, | |
siteH, siteW, | |
body = $('body'); | |
windowMain = $(window); | |
home.thisIsTheMainObject = function () { | |
var thisIsTheMainObject = {}; | |
thisIsTheMainObject.init = function() { | |
window.console.log(saywhit + ' this is the saywhit variable'); | |
} | |
thisIsTheMainObject.spin = function() { | |
window.console.log('spin it'); | |
} | |
window.alert('cannot'); | |
return thisIsTheMainObject; | |
}(); | |
home.init = function () { | |
home.thisIsTheMainObject; | |
// home.thisIsTheMainObject.spinit(); | |
}; | |
return home; // must return app; for contents of app {} object to be accessible to browser | |
})(); | |
$(function(){ | |
$home.init(); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment