Last active
August 29, 2015 14:15
-
-
Save dirq/d4003c492a4470ba0edf to your computer and use it in GitHub Desktop.
JavaScript Closure IFFY Module
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
var app = (function () | |
{ | |
'use strict'; | |
var self = {}, | |
debug = true; | |
function log(msg) | |
{ | |
if (debug && console && console.log) | |
{ | |
console.log(msg); | |
} | |
} | |
self.init = function () | |
{ | |
log('init'); | |
}; | |
return self; | |
}()); | |
//plan JS load | |
if (document.addEventListener) | |
{ | |
//For modern browsers: | |
document.addEventListener('DOMContentLoaded', app.init, false); | |
} | |
else if (document.attachEvent) | |
{ | |
//For IE: | |
document.attachEvent('onreadystatechange', app.init); | |
} | |
//jquery load | |
//$(app.init); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment