{"size": 2678, "ext": "js", "max_stars_repo_path": "src/core/plugin.js", "max_stars_repo_name": "CaijinChen/fineui", "max_stars_repo_stars_event_min_datetime": "2017-04-01T03:14:16.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-14T02:34:26.000Z", "max_issues_repo_path": "src/core/plugin.js", "max_issues_repo_name": "CaijinChen/fineui", "max_issues_repo_issues_event_min_datetime": "2017-06-15T06:08:37.000Z", "max_issues_repo_issues_event_max_datetime": "2021-06-23T07:35:05.000Z", "max_forks_repo_path": "src/core/plugin.js", "max_forks_repo_name": "CaijinChen/fineui", "max_forks_repo_forks_event_min_datetime": "2017-03-30T09:10:49.000Z", "max_forks_repo_forks_event_max_datetime": "2021-08-23T14:59:37.000Z"}
{"max_stars_count": 99, "max_issues_count": 5, "max_forks_count": 44, "avg_line_length": 30.7816091954, "max_line_length": 81, "alphanum_fraction": 0.4451082898}
BI.Plugin = BI.Plugin || {};
!(function () {
    var _WidgetsPlugin = {};
    var _ObjectPlugin = {};
    var _ConfigPlugin = {};
    var _GlobalWidgetConfigFn, _GlobalObjectConfigFn;
    BI.extend(BI.Plugin, {

        getWidget: function (type, options) {
            if (_GlobalWidgetConfigFn) {
                _GlobalWidgetConfigFn(type, options);
            }
            var res;
            if (_ConfigPlugin[type]) {
                for (var i = _ConfigPlugin[type].length - 1; i >= 0; i--) {
                    if (res = _ConfigPlugin[type][i](options)) {
                        options = res;
                    }
                }
            }
            // Deprecated
            if (_WidgetsPlugin[type]) {
                for (var i = _WidgetsPlugin[type].length - 1; i >= 0; i--) {
                    if (res = _WidgetsPlugin[type][i](options)) {
                        return res;
                    }
                }
            }
            return options;
        },

        config: function (widgetConfigFn, objectConfigFn) {
            _GlobalWidgetConfigFn = widgetConfigFn;
            _GlobalObjectConfigFn = objectConfigFn;
        },

        configWidget: function (type, fn) {
            if (!_ConfigPlugin[type]) {
                _ConfigPlugin[type] = [];
            }
            _ConfigPlugin[type].push(fn);
        },

        registerWidget: function (type, fn) {
            if (!_WidgetsPlugin[type]) {
                _WidgetsPlugin[type] = [];
            }
            if (_WidgetsPlugin[type].length > 0) {
                console.log("组件已经注册过了!");
            }
            _WidgetsPlugin[type].push(fn);
        },

        relieveWidget: function (type) {
            delete _WidgetsPlugin[type];
        },

        getObject: function (type, object) {
            if (_GlobalObjectConfigFn) {
                _GlobalObjectConfigFn(type, object);
            }
            if (_ObjectPlugin[type]) {
                var res;
                for (var i = 0, len = _ObjectPlugin[type].length; i < len; i++) {
                    if (res = _ObjectPlugin[type][i](object)) {
                        object = res;
                    };
                }
            }
            return res || object;
        },

        registerObject: function (type, fn) {
            if (!_ObjectPlugin[type]) {
                _ObjectPlugin[type] = [];
            }
            if (_ObjectPlugin[type].length > 0) {
                console.log("对象已经注册过了!");
            }
            _ObjectPlugin[type].push(fn);
        },

        relieveObject: function (type) {
            delete _ObjectPlugin[type];
        }
    });
})();