Skip to content

Instantly share code, notes, and snippets.

Created February 4, 2014 19:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save anonymous/8811042 to your computer and use it in GitHub Desktop.
Save anonymous/8811042 to your computer and use it in GitHub Desktop.
SMD
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