Created
February 4, 2014 19:52
-
-
Save anonymous/8811042 to your computer and use it in GitHub Desktop.
SMD
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
var __modules__ = {}; | |
function require(id) { | |
var module = __modules__[id]; | |
if(!module) throw new Error('Module not yet defined'); | |
// Get the module's exports lazily (allows registration in any order as long | |
// as main script entry point comes last). | |
return __modules__[id] = (typeof(module) === 'function') ? | |
module(require, {}) : module; | |
} | |
function define(id, factory) { | |
if (__modules__[id]) throw new Error('Another module already has this name'); | |
__modules__[id] = factory; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment