Browse Source

可以两个fineui一起运行

es6
guy 4 years ago
parent
commit
1721393f69
  1. 4
      src/core/func/function.js
  2. 34
      src/core/inject.js
  3. 6
      src/core/ob.js
  4. 2
      src/core/platform/web/dom.js
  5. 2
      src/core/plugin.js
  6. 6
      src/core/shortcut.js
  7. 4
      src/core/widget.js

4
src/core/func/function.js

@ -2,7 +2,7 @@
* 基本的函数 * 基本的函数
* Created by GUY on 2015/6/24. * Created by GUY on 2015/6/24.
*/ */
BI.Func = {}; BI.Func = BI.Func || {};
_.extend(BI.Func, { _.extend(BI.Func, {
/** /**
* 创建唯一的名字 * 创建唯一的名字
@ -165,4 +165,4 @@ _.extend(BI, {
return ret; return ret;
}; };
} }
}); });

34
src/core/inject.js

@ -1,6 +1,6 @@
(function () { (function () {
var moduleInjection = {}; var moduleInjection = {};
BI.module = function (xtype, cls) { BI.module = BI.module || function (xtype, cls) {
if (moduleInjection[xtype] != null) { if (moduleInjection[xtype] != null) {
_global.console && console.error("module:[" + xtype + "] has been registed"); _global.console && console.error("module:[" + xtype + "] has been registed");
} }
@ -8,7 +8,7 @@
}; };
var constantInjection = {}; var constantInjection = {};
BI.constant = function (xtype, cls) { BI.constant = BI.constant || function (xtype, cls) {
if (constantInjection[xtype] != null) { if (constantInjection[xtype] != null) {
_global.console && console.error("constant:[" + xtype + "] has been registed"); _global.console && console.error("constant:[" + xtype + "] has been registed");
} }
@ -16,7 +16,7 @@
}; };
var modelInjection = {}; var modelInjection = {};
BI.model = function (xtype, cls) { BI.model = BI.model || function (xtype, cls) {
if (modelInjection[xtype] != null) { if (modelInjection[xtype] != null) {
_global.console && console.error("model:[" + xtype + "] has been registed"); _global.console && console.error("model:[" + xtype + "] has been registed");
} }
@ -24,7 +24,7 @@
}; };
var storeInjection = {}; var storeInjection = {};
BI.store = function (xtype, cls) { BI.store = BI.store || function (xtype, cls) {
if (storeInjection[xtype] != null) { if (storeInjection[xtype] != null) {
_global.console && console.error("store:[" + xtype + "] has been registed"); _global.console && console.error("store:[" + xtype + "] has been registed");
} }
@ -32,7 +32,7 @@
}; };
var serviceInjection = {}; var serviceInjection = {};
BI.service = function (xtype, cls) { BI.service = BI.service || function (xtype, cls) {
if (serviceInjection[xtype] != null) { if (serviceInjection[xtype] != null) {
_global.console && console.error("service:[" + xtype + "] has been registed"); _global.console && console.error("service:[" + xtype + "] has been registed");
} }
@ -40,7 +40,7 @@
}; };
var providerInjection = {}; var providerInjection = {};
BI.provider = function (xtype, cls) { BI.provider = BI.provider || function (xtype, cls) {
if (providerInjection[xtype] != null) { if (providerInjection[xtype] != null) {
_global.console && console.error("provider:[" + xtype + "] has been registed"); _global.console && console.error("provider:[" + xtype + "] has been registed");
} }
@ -48,7 +48,7 @@
}; };
var configFunctions = {}; var configFunctions = {};
BI.config = function (type, configFn, opt) { BI.config = BI.config || function (type, configFn, opt) {
if (BI.initialized) { if (BI.initialized) {
if (constantInjection[type]) { if (constantInjection[type]) {
return (constantInjection[type] = configFn(constantInjection[type])); return (constantInjection[type] = configFn(constantInjection[type]));
@ -94,7 +94,7 @@
var actions = {}; var actions = {};
var globalAction = []; var globalAction = [];
BI.action = function (type, actionFn) { BI.action = BI.action || function (type, actionFn) {
if (BI.isFunction(type)) { if (BI.isFunction(type)) {
globalAction.push(type); globalAction.push(type);
return function () { return function () {
@ -118,7 +118,7 @@
}; };
var points = {}; var points = {};
BI.point = function (type, action, pointFn, after) { BI.point = BI.point || function (type, action, pointFn, after) {
if (!points[type]) { if (!points[type]) {
points[type] = {}; points[type] = {};
} }
@ -131,7 +131,7 @@
points[type][action][after ? "after" : "before"].push(pointFn); points[type][action][after ? "after" : "before"].push(pointFn);
}; };
BI.Modules = { BI.Modules = BI.Modules || {
getModule: function (type) { getModule: function (type) {
if (!moduleInjection[type]) { if (!moduleInjection[type]) {
_global.console && console.error("module:[" + type + "] does not exists"); _global.console && console.error("module:[" + type + "] does not exists");
@ -144,7 +144,7 @@
} }
}; };
BI.Constants = { BI.Constants = BI.Constants || {
getConstant: function (type) { getConstant: function (type) {
return constantInjection[type]; return constantInjection[type];
} }
@ -188,7 +188,7 @@
}); });
}; };
BI.Models = { BI.Models = BI.Models || {
getModel: function (type, config) { getModel: function (type, config) {
var inst = new modelInjection[type](config); var inst = new modelInjection[type](config);
inst._constructor && inst._constructor(config); inst._constructor && inst._constructor(config);
@ -200,7 +200,7 @@
var stores = {}; var stores = {};
BI.Stores = { BI.Stores = BI.Stores || {
getStore: function (type, config) { getStore: function (type, config) {
if (stores[type]) { if (stores[type]) {
return stores[type]; return stores[type];
@ -216,7 +216,7 @@
var services = {}; var services = {};
BI.Services = { BI.Services = BI.Services || {
getService: function (type, config) { getService: function (type, config) {
if (services[type]) { if (services[type]) {
return services[type]; return services[type];
@ -230,7 +230,7 @@
var providers = {}, var providers = {},
providerInstance = {}; providerInstance = {};
BI.Providers = { BI.Providers = BI.Providers || {
getProvider: function (type, config) { getProvider: function (type, config) {
if (!providers[type]) { if (!providers[type]) {
providers[type] = new providerInjection[type](); providers[type] = new providerInjection[type]();
@ -242,7 +242,7 @@
} }
}; };
BI.Actions = { BI.Actions = BI.Actions || {
runAction: function (type, event, config) { runAction: function (type, event, config) {
BI.each(actions[type], function (i, act) { BI.each(actions[type], function (i, act) {
try { try {
@ -264,7 +264,7 @@
} }
}; };
BI.getContext = function (type, config) { BI.getContext = BI.getContext || function (type, config) {
if (constantInjection[type]) { if (constantInjection[type]) {
return BI.Constants.getConstant(type); return BI.Constants.getConstant(type);
} }

6
src/core/ob.js

@ -28,10 +28,10 @@
* @class BI.OB * @class BI.OB
* @abstract * @abstract
*/ */
BI.OB = function (config) { BI.OB = BI.OB || function (config) {
this._constructor(config); this._constructor(config);
}; };
_.extend(BI.OB.prototype, { _.defaults(BI.OB.prototype, {
props: {}, props: {},
init: null, init: null,
destroyed: null, destroyed: null,
@ -184,4 +184,4 @@
this.purgeListeners(); this.purgeListeners();
} }
}); });
})(); })();

2
src/core/platform/web/dom.js

@ -3,7 +3,7 @@
* @type {{}} * @type {{}}
*/ */
!(function () { !(function () {
BI.DOM = {}; BI.DOM = BI.DOM || {};
BI.extend(BI.DOM, { BI.extend(BI.DOM, {
ready: function (fn) { ready: function (fn) {

2
src/core/plugin.js

@ -5,7 +5,7 @@ BI.Plugin = BI.Plugin || {};
var _ConfigPlugin = {}; var _ConfigPlugin = {};
var _GlobalWidgetConfigFns = []; var _GlobalWidgetConfigFns = [];
var __GlobalObjectConfigFns = []; var __GlobalObjectConfigFns = [];
BI.extend(BI.Plugin, { BI.defaults(BI.Plugin, {
getWidget: function (type, options) { getWidget: function (type, options) {
if (_GlobalWidgetConfigFns.length > 0) { if (_GlobalWidgetConfigFns.length > 0) {

6
src/core/shortcut.js

@ -1,6 +1,6 @@
(function () { (function () {
var kv = {}; var kv = {};
BI.shortcut = BI.component = function (xtype, cls) { BI.shortcut = BI.component = BI.shortcut || function (xtype, cls) {
if (kv[xtype] != null) { if (kv[xtype] != null) {
_global.console && console.error("shortcut:[" + xtype + "] has been registed"); _global.console && console.error("shortcut:[" + xtype + "] has been registed");
} }
@ -24,7 +24,7 @@
return widget; return widget;
}; };
BI.createWidget = function (item, options, context) { BI.createWidget = BI.createWidget || function (item, options, context) {
// 先把准备环境准备好 // 先把准备环境准备好
BI.init(); BI.init();
var el, w; var el, w;
@ -71,7 +71,7 @@
throw new Error("无法根据item创建组件"); throw new Error("无法根据item创建组件");
}; };
BI.createElement = function () { BI.createElement = BI.createElement || function () {
var widget = BI.createWidget.apply(this, arguments); var widget = BI.createWidget.apply(this, arguments);
return widget.element; return widget.element;
}; };

4
src/core/widget.js

@ -7,7 +7,7 @@
*/ */
!(function () { !(function () {
BI.Widget = BI.inherit(BI.OB, { BI.Widget = BI.Widget || BI.inherit(BI.OB, {
_defaultConfig: function () { _defaultConfig: function () {
return BI.extend(BI.Widget.superclass._defaultConfig.apply(this), { return BI.extend(BI.Widget.superclass._defaultConfig.apply(this), {
root: false, root: false,
@ -545,4 +545,4 @@
} }
return widget._mount(true, false, false, predicate); return widget._mount(true, false, false, predicate);
}; };
})(); })();

Loading…
Cancel
Save