JavaScript模块加载器Melchior.js.zip

时间:2022-08-07 13:28:14
【文件属性】:
文件名称:JavaScript模块加载器Melchior.js.zip
文件大小:1.6MB
文件格式:JS
更新时间:2022-08-07 13:28:14
开源项目 Melchior.js 是一个模式加载器,提供通过链式模块定义的API,让你可以远离那些长长的AMD定义和重复的模块名。它起步非常容易,定制方便,而且压缩版只有3KB。 在线演示 示例代码: // create modulemelchiorjs.module('yourModule')// define dependencies.require('dependencyUno') .require('dependencyDuo', 'duo')// define module body.body(function () {    // `dependencyUno` is available here!     dependencyUno.doSomething();    // aliased `dependencyDuo` is available as `duo`!     duo.doSomething();    // return methods for other modules     return {         method: function () { ... },         anotherMethod: function () { ... }     }; }); 配置: melchiorjs.config({     paths: {        'jQuery': 'path/to/jquery',        'underscore': 'path/to/underscore',        'myModule': 'path/to/myModule'     },    // provide shim to non-melchior modules if needed     // declare globals returned by libraries and deps     shim: {         underscore: {             exports: '_'         }     } }); 支持的浏览器: 1 ✔ 2 ✔ 8 ✔ 10 ✔ 3 ✔ 标签:Melchior

网友评论