Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

能否加个功能自动过滤amd模块的包装 #11

Open
nfjBill opened this issue Jan 26, 2016 · 2 comments
Open

能否加个功能自动过滤amd模块的包装 #11

nfjBill opened this issue Jan 26, 2016 · 2 comments

Comments

@nfjBill
Copy link

nfjBill commented Jan 26, 2016

比如有个

define(function(require) {

    'use strict';

    var zrUtil = require('zrender/core/util');

    var echartsAPIList = [
        'getDom', 'getZr', 'getWidth', 'getHeight', 'dispatchAction',
        'on', 'off', 'getDataURL', 'getConnectedDataURL'
    ];

    function ExtensionAPI(chartInstance) {
        zrUtil.each(echartsAPIList, function (name) {
            this[name] = zrUtil.bind(chartInstance[name], chartInstance);
        }, this);
    }

    return ExtensionAPI;
});

自动变成

    'use strict';

    var zrUtil = require('zrender/core/util');

    var echartsAPIList = [
        'getDom', 'getZr', 'getWidth', 'getHeight', 'dispatchAction',
        'on', 'off', 'getDataURL', 'getConnectedDataURL'
    ];

    function ExtensionAPI(chartInstance) {
        zrUtil.each(echartsAPIList, function (name) {
            this[name] = zrUtil.bind(chartInstance[name], chartInstance);
        }, this);
    }

    module.exports = ExtensionAPI;

省得从别的地方下载三方后还得自己手动修改代码

@2betop
Copy link
Contributor

2betop commented Jan 28, 2016

还是 fis3 install zrender 吧, fis-components 里面的都是转换后了的。

@nfjBill
Copy link
Author

nfjBill commented Jan 29, 2016

没有啥一劳永逸的方法么

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants