InjectAMD/CJS 依赖管理器
Inject 是 AMD 和 CJS 依赖管理器,它以一种 Library Agnosti c 的方式来管理你的依赖。主要特性包括:
-
基于浏览器的 CommonJS 规范
-
查看更完整的 CommonJS Support Matrix
-
-
跨域检索文件的Cross domain retrieval of files (via easyXDM)
-
本地存储 (一次加载一个模块)
-
十分简单
快速配置
// Set the "root" where all your modules can be found
// you can use an http:// path or just /path/to/modules like above
Inject.setModuleRoot("path");
// Specify how long files should be in localStorage (in minutes)
// or 0 for never, which is great for development
Inject.setExpires(integerValue);
// configure "cross domain" support. You need to put "relay.swf" and "relay.html"
// on your remote server for this to work
Inject.setModuleRoot("http://example-cdn.com/modules");
Inject.setCrossDomain({
relayHtml: "http://example-cdn.com/relay.html",
});
评论
