Register modules first, but do not execute the callbacks until a matching `require` has been requested for this module.
171602
function(moduleName, deps, callback) {
  //if (moduleName === "jquery/selector") { debugger; }
  if (!deps && !callback) {
    return;
  }

  // Allow deps to be optional.
  if (!callback && typeof deps === "function") {
    callback = deps;
    deps = undefined;
  }

  // Ensure dependencies is never falsey.
  deps = deps || [];

  // Normalize the dependencies.
  deps = deps.map(function(dep) {
    if (dep.indexOf("./") === -1) {
      return dep;
    }

    // Take off the last path.
    var normalize = moduleName.split("/").slice(0, -1).join("/");

    //console.log(normalize, dep, define.join(normalize, dep));
    return define.join(normalize, dep);
  });

  // Attach to the module map.
  define.map[moduleName] = {
    moduleName: moduleName,
    deps: deps,
    callback: callback
  };
}
1198702
function(options){
    // Prevent re-starting a module that is already started
    if (this._isInitialized){ return; }

    // start the sub-modules (depth-first hierarchy)
    _.each(this.submodules, function(mod){
      // check to see if we should start the sub-module with this parent
      if (mod.startWithParent){
        mod.start(options);
      }
    });

    // run the callbacks to "start" the current module
    this.triggerMethod("before:start", options);

    this._initializerCallbacks.run(options, this);
    this._isInitialized = true;

    this.triggerMethod("start", options);
  }
1274570
def load_modules(self):
        """"""
        if self.INTERFACES_MODULE is None:
            raise NotImplementedError("A module containing interfaces modules "
                                      "should be setup in INTERFACES_MODULE !")
        else:
            for module, permission in self.modules.items():
                i = getattr(self.INTERFACES_MODULE,
                            module).Interface(self, permission)
                self.interfaces[module] = i
1317873
function runtimeRequire (moduleName, realm) {
  try {
    const ownModule = resolveApp('node_modules', moduleName);
    if (fs.existsSync(ownModule)) moduleName = ownModule;
    return require(moduleName);
  } catch (err) {
    if ('MODULE_NOT_FOUND' === err.code) {
      throw new RuntimeModuleNotFound(err, realm);
    }
    throw err;
  }
}
1249103
def register_callback(self, callback):
        
        if not callable(callback):
            raise ValueError('callback is not a callable')

        self.callbacks.append(callback)
396591
def register():
    """"""
    if not plim:
        logger.warning('`slim` failed to load dependency `plim`. '
                       '`slim` plugin not loaded.')
        return
    if not mako:
        logger.warning('`slim` failed to load dependency `mako`. '
                       '`slim` plugin not loaded.')
        return
    if not bs:
        logger.warning('`slim` failed to load dependency `BeautifulSoup4`. '
                       '`slim` plugin not loaded.')
        return
    if not minify:
        logger.warning('`slim` failed to load dependency `htmlmin`. '
                       '`slim` plugin not loaded.')
        return

    signals.get_writer.connect(get_writer)
423129
function(parentModule, id, callback) {

  // Try to load the module.
  return Promise.try(function() {
    return parentModule.require(id);
  })
  // Ignore module not found errors, and decorate all others.
  .catch(function(err) {
    if (err.code !== 'MODULE_NOT_FOUND') {
      throw new KboxRequireError(id, err);
    }
  })
  // Return.
  .nodeify(callback);

}
400533
public function init()
    {
        foreach (self::$registered as $path => $module) {
            $path = trailingslashit($path);
            $source = $path . $module . '.php';
            $namespace = \Modularity\Helper\File::getNamespace($source);

            if (!$namespace) {
                continue;
            }

            require_once $source;
            $class = $namespace . '\\' . $module;
            $class = new $class();

            $this->register($class, $path);
        }

        do_action('Modularity/Init', $this);
    }
693733
def unregister_module(self, module):
        
        if module not in self._namespaces.values():
            raise NoRegisteredError("Module '{0}' is not registered on loader.".format(module))

        for ns, mod in list(self._namespaces.items()):
            if mod == module:
                self.unregister_namespace(ns)
320446
public final function registerModule(Module $module)
    {
        $dependencies = $module->getModules();

        foreach($dependencies as $dependency){
            $this->registerModule($dependency);
        }

        $this->modules[$module->getModuleName()] = $module;
    }
735779
def register_callback(self, callback, remove=False):
        """"""

        # (Un)Register the callback.
        if remove and callback in self.callbacks:
            self.callbacks.remove(callback)
        elif not remove and callback not in self.callbacks:
            self.callbacks.append(callback)
128153
function require_reset() {
    ModuleStore        = {}
    ModulePreloadStore = {}
    MainModule         = create_module(null)

    var require = get_require(MainModule)
    var define  = require_define
    
    define("modjewel", modjewel_module)

    global.modjewel            = require("modjewel")
    global.modjewel.require    = require
    global.modjewel.define     = define
    global.modjewel.define.amd = {implementation: PROGRAM, version: VERSION}
}
910203
function initModule(modName, mod) {
        console.log("Initialising "+modName);
        if (mod.init !== undefined)
          mod.init();
      }
648763
function(module) {
			if (!module) {
				return;
			}

			var file = fileByModules(module);
			Array.prototype.push.apply(seen, file.modules);
			file.requires.forEach(function(module) {
				// Ignore resoled modules and dependencies in own file
				if((_.indexOf(resolved, module) < 0) &&
				   (_.indexOf(file.modules, module) < 0)) {
					// Catch circular dependencies
					if(_.indexOf(seen, module) < 0) {
						resolve(module);
					}
					else {
						grunt.fail.fatal('Circular dependency detected:\n\t' +
						                 file.modules.join(', ') + ' depend on ' +
						                 module, 1);
					}
				}
			});
			Array.prototype.push.apply(resolved, file.modules);
		}
224087
def register_module(self, module, namespace=None):
        
        namespace = namespace if namespace is not None else module \
            if isinstance(module, str) else module.__name__
        self.register_namespace(namespace, module)
11141
@Bind(optional = true, aggregate = true)
    public synchronized void bindModule(Module module) {
        register(module);
    }
570492
def add(modname, features, required_version, installed_version=None,
        optional=False):
    """"""
    global DEPENDENCIES
    for dependency in DEPENDENCIES:
        if dependency.modname == modname:
            raise ValueError("Dependency has already been registered: %s"\
                             % modname)
    DEPENDENCIES += [Dependency(modname, features, required_version,
                                installed_version, optional)]