Skip to content

Instantly share code, notes, and snippets.

@eridal
Forked from paton/simple.js
Created October 30, 2015 17:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eridal/8f1ce40ce551ff78a7c4 to your computer and use it in GitHub Desktop.
Save eridal/8f1ce40ce551ff78a7c4 to your computer and use it in GitHub Desktop.
Super simple implementation of define() and require() used in Localize.js (https://localizejs.com)
var define, require;
(function() {
var modules = {};
require = function(name) {
return modules[name]();
};
define = function(name, fn) {
var exports;
modules[name] = function() {
if (!exports) {
exports = {};
exports = fn(require, exports) || exports;
}
return exports;
};
};
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment