Jingo provides similar functionality to the “import” features of Java and Python.
实例代码
jingo.declare({ require: [ 'hallmart.util.iterators', 'hallmart.Store' ], name: 'hallmart.app', as: function() { // a local alias that does not pollute the global namespace var each = hallmart.util.iterators.each; var customers = [ {name: 'Bil'}, {name: 'Ted'}, {name: 'Joe'} ]; var store = new hallmart.Store(); each(customers, function(index, value) { store.admit(value); }); } }); <html> <head> <title>The HallMart Example</title> <script type="text/javascript" src="scripts/jingo.js"></script> <script type="text/javascript"> jingo.anonymous({require: ['hallmart.app']}); </script> </head> <body> <p>The HallMart Example</p> </body> </html>