Created
July 9, 2013 01:25
-
-
Save andyperlitch/5953916 to your computer and use it in GitHub Desktop.
A browserify bundle, with better variable names and formatting for better understanding.
This file contains hidden or 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
| ;(function(mod_hash, cache_hash, entryArray) { | |
| // Check if require is defined elsewhere | |
| var outerRequire = typeof require == "function" && require; | |
| function invokeModule(index, tried) { | |
| if (!cache_hash[index]) { | |
| // Not in the overrides hash | |
| if (!mod_hash[index]) { | |
| // Not in the main hash | |
| // Check for require now | |
| var innerRequire = typeof require == "function" && require; | |
| // Check if we've tried inner require | |
| if (!tried && innerRequire) { | |
| return innerRequire(index, !0); | |
| } | |
| if (outerRequire) { | |
| return outerRequire(index, !0); | |
| } | |
| throw new Error("Cannot find module '" + index + "'") | |
| } | |
| // Set up context for newly loaded module | |
| var new_module = cache_hash[index] = {exports: {}}; | |
| // Invoke the module | |
| mod_hash[index][0].call( | |
| // Set context to exports | |
| new_module.exports, | |
| // Define the require method | |
| function(module_path) { | |
| var result = mod_hash[index][1][module_path]; | |
| return invokeModule( result ? result : module_path ); | |
| }, | |
| // Pass module | |
| new_module, | |
| // Pass exports | |
| new_module.exports | |
| ) | |
| } | |
| return cache_hash[index].exports | |
| } | |
| for (var s = 0; s < entryArray.length; s++) { | |
| invokeModule(entryArray[s]); | |
| } | |
| return invokeModule; | |
| })( | |
| { | |
| 1:[ | |
| function(require,module,exports){ | |
| var mod0 = require('./mod0'); | |
| $(function() { | |
| var title = document.getElementById('title'); | |
| var trg = document.getElementById('target'); | |
| title.innerHTML = mod0.use1(); | |
| mod0.use2(trg); | |
| }); | |
| }, | |
| { | |
| "./mod0":2 | |
| } | |
| ], | |
| 2:[ | |
| function(require,module,exports){ | |
| (function(){ | |
| var mod1 = require('./mod1'); | |
| var mod2 = require('./mod2'); | |
| exports = module.exports = { | |
| use1: function() { | |
| return mod1(); | |
| }, | |
| use2: function(elem) { | |
| mod2(function(text) { | |
| elem.innerHTML = text; | |
| }); | |
| } | |
| }; | |
| })() | |
| }, | |
| { | |
| "./mod1":3, | |
| "./mod2":4 | |
| } | |
| ], | |
| 3:[ | |
| function(require,module,exports){ | |
| exports = module.exports = function(params) { | |
| return "Some response to a web service call"; | |
| }; | |
| }, | |
| { | |
| } | |
| ], | |
| 4:[ | |
| function(require,module,exports){ | |
| exports = module.exports = function(cb) { | |
| setTimeout(function() { | |
| cb("Real text"); | |
| },100); | |
| }; | |
| }, | |
| { | |
| } | |
| ] | |
| }, | |
| {}, | |
| [1] | |
| ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment