systemjs是一个最小系统加载工具,用来创建插件来处理可替代的场景加载过程,包括加载CSS场景和图片,主要运行在浏览器和NodeJS中。它是ES6浏览器加载程序的的扩展,将应用在本地浏览器中。通常创建的插件名称是模块本身,要是没有特意指定用途,则默认插件名是模块的扩展名称。
通常它支持创建的插件种类有:
CSSSystem.import('my/file.css!')
ImageSystem.import('some/image.pg!image')
JSONSystem.import('some/data.jso!').the(fuctio(jso){})
MarkdowSystem.import('app/some/project/README.md!').the(fuctio(html){})
TextSystem.import('some/text.txt!text').the(fuctio(text){})
WebFotSystem.import('googlePortLligatSlab,DroidSas!fot')
示例:
System.formats = ['amd', 'cjs', 'myformat', 'global']; System.format.myformat = { detect: fuctio(source, load) { if (!source.match(formatRegEx)) retur false; // retur the array of depedecies retur getDeps(source); }, execute: fuctio(load, depMap, global, execute) { // provide ay globals global.myFormatGlobal = fuctio(dep) { retur depMap[dep]; } // alter the source before executio load.source = '(fuctio() {' + load.source + '}();'; // execute source code execute(); // clea up ay globals delete global.myFormatGlobal; // retur the defied module object retur global.module; } }






评论