Skip to content

Instantly share code, notes, and snippets.

@koshdnb
Forked from pellebjerkestrand/initialization.js
Created November 8, 2015 13:01
Show Gist options
  • Select an option

  • Save koshdnb/bc9bad2fbb561697c9e1 to your computer and use it in GitHub Desktop.

Select an option

Save koshdnb/bc9bad2fbb561697c9e1 to your computer and use it in GitHub Desktop.
Initialization meta module
(function(global){
/* Initialization meta module. Pelle Bjerkestrand. WTFPL. */
'use strict';
var app = global.app || {};
function init(){
for (var key in app) {
if (app.hasOwnProperty(key)) {
var module = app[key];
if(!!module.init && typeof module.init === "function"){
module.init();
}
}
}
}
app.init = init;
global.document.addEventListener("DOMContentLoaded", function() {
app.init();
});
global.app = app;
})(this);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment