-
-
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)
This file contains 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 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