Ajile (Advanced JavaScript Importing & Loading Extension) 可以让开发人员轻松的创建独立名字空间的 JavaScript 模块,并定义脚本之间的依赖关系,以便于根据需要自动加载相关的 js 库。
示例代码:
Load ("scripts/com.iskitz.ajile.examples.LoadExample.js"); function testLoad() { if( "undefined" != typeof com.iskitz.ajile.examples && "undefined" != typeof com.iskitz.ajile.examples.LoadExample) com.iskitz.ajile.examples.LoadExample(); else alert( "Load test was unsuccessful :-(\n\n" + "Failed to Load [ com.iskitz.ajile.examples.LoadExample.js ]"); } /** LoadExample.js: *******************************************************/ Namespace("com.iskitz.ajile.examples"); com.iskitz.ajile.examples.LoadExample = function() { var msg = navigator.userAgent + "\n\n\t\t" + "Successfully Loaded [ com.iskitz.ajile.examples.LoadExample ]!"; alert(msg); };