definition
var MyModules = (function Manager() { var modules = {}; function define (name, deps, impl) { for(var j = 0, length = ; j < length; j++){ deps[j] = modules[deps[j]]; } modules[name] = (impl, deps); } function get (name) { return modules[name]; } return { define: define, get: get } })();
use
('test1', [], function() { function hello(name) { (name); } return { hello: hello } }); ('test2', ['test1'], function(test1) { function age(name, age) { ((name)); (age); } return { age: age } }); ('test2').age('mumu', '27');
The above is all the code content shared this time. You can test it. If you still don’t understand anything, you can discuss it in the comment area below. Thank you for your support.