From 1721393f699c268c0d2b9459b3c233fc0db7a3a1 Mon Sep 17 00:00:00 2001 From: guy Date: Thu, 9 Jul 2020 19:45:33 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8F=AF=E4=BB=A5=E4=B8=A4=E4=B8=AAfineui?= =?UTF-8?q?=E4=B8=80=E8=B5=B7=E8=BF=90=E8=A1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/core/func/function.js | 4 ++-- src/core/inject.js | 34 +++++++++++++++++----------------- src/core/ob.js | 6 +++--- src/core/platform/web/dom.js | 2 +- src/core/plugin.js | 2 +- src/core/shortcut.js | 6 +++--- src/core/widget.js | 4 ++-- 7 files changed, 29 insertions(+), 29 deletions(-) diff --git a/src/core/func/function.js b/src/core/func/function.js index 7b826946b..6cc8d8d93 100644 --- a/src/core/func/function.js +++ b/src/core/func/function.js @@ -2,7 +2,7 @@ * 基本的函数 * Created by GUY on 2015/6/24. */ -BI.Func = {}; +BI.Func = BI.Func || {}; _.extend(BI.Func, { /** * 创建唯一的名字 @@ -165,4 +165,4 @@ _.extend(BI, { return ret; }; } -}); \ No newline at end of file +}); diff --git a/src/core/inject.js b/src/core/inject.js index f49334e89..99abd2239 100644 --- a/src/core/inject.js +++ b/src/core/inject.js @@ -1,6 +1,6 @@ (function () { var moduleInjection = {}; - BI.module = function (xtype, cls) { + BI.module = BI.module || function (xtype, cls) { if (moduleInjection[xtype] != null) { _global.console && console.error("module:[" + xtype + "] has been registed"); } @@ -8,7 +8,7 @@ }; var constantInjection = {}; - BI.constant = function (xtype, cls) { + BI.constant = BI.constant || function (xtype, cls) { if (constantInjection[xtype] != null) { _global.console && console.error("constant:[" + xtype + "] has been registed"); } @@ -16,7 +16,7 @@ }; var modelInjection = {}; - BI.model = function (xtype, cls) { + BI.model = BI.model || function (xtype, cls) { if (modelInjection[xtype] != null) { _global.console && console.error("model:[" + xtype + "] has been registed"); } @@ -24,7 +24,7 @@ }; var storeInjection = {}; - BI.store = function (xtype, cls) { + BI.store = BI.store || function (xtype, cls) { if (storeInjection[xtype] != null) { _global.console && console.error("store:[" + xtype + "] has been registed"); } @@ -32,7 +32,7 @@ }; var serviceInjection = {}; - BI.service = function (xtype, cls) { + BI.service = BI.service || function (xtype, cls) { if (serviceInjection[xtype] != null) { _global.console && console.error("service:[" + xtype + "] has been registed"); } @@ -40,7 +40,7 @@ }; var providerInjection = {}; - BI.provider = function (xtype, cls) { + BI.provider = BI.provider || function (xtype, cls) { if (providerInjection[xtype] != null) { _global.console && console.error("provider:[" + xtype + "] has been registed"); } @@ -48,7 +48,7 @@ }; var configFunctions = {}; - BI.config = function (type, configFn, opt) { + BI.config = BI.config || function (type, configFn, opt) { if (BI.initialized) { if (constantInjection[type]) { return (constantInjection[type] = configFn(constantInjection[type])); @@ -94,7 +94,7 @@ var actions = {}; var globalAction = []; - BI.action = function (type, actionFn) { + BI.action = BI.action || function (type, actionFn) { if (BI.isFunction(type)) { globalAction.push(type); return function () { @@ -118,7 +118,7 @@ }; var points = {}; - BI.point = function (type, action, pointFn, after) { + BI.point = BI.point || function (type, action, pointFn, after) { if (!points[type]) { points[type] = {}; } @@ -131,7 +131,7 @@ points[type][action][after ? "after" : "before"].push(pointFn); }; - BI.Modules = { + BI.Modules = BI.Modules || { getModule: function (type) { if (!moduleInjection[type]) { _global.console && console.error("module:[" + type + "] does not exists"); @@ -144,7 +144,7 @@ } }; - BI.Constants = { + BI.Constants = BI.Constants || { getConstant: function (type) { return constantInjection[type]; } @@ -188,7 +188,7 @@ }); }; - BI.Models = { + BI.Models = BI.Models || { getModel: function (type, config) { var inst = new modelInjection[type](config); inst._constructor && inst._constructor(config); @@ -200,7 +200,7 @@ var stores = {}; - BI.Stores = { + BI.Stores = BI.Stores || { getStore: function (type, config) { if (stores[type]) { return stores[type]; @@ -216,7 +216,7 @@ var services = {}; - BI.Services = { + BI.Services = BI.Services || { getService: function (type, config) { if (services[type]) { return services[type]; @@ -230,7 +230,7 @@ var providers = {}, providerInstance = {}; - BI.Providers = { + BI.Providers = BI.Providers || { getProvider: function (type, config) { if (!providers[type]) { providers[type] = new providerInjection[type](); @@ -242,7 +242,7 @@ } }; - BI.Actions = { + BI.Actions = BI.Actions || { runAction: function (type, event, config) { BI.each(actions[type], function (i, act) { try { @@ -264,7 +264,7 @@ } }; - BI.getContext = function (type, config) { + BI.getContext = BI.getContext || function (type, config) { if (constantInjection[type]) { return BI.Constants.getConstant(type); } diff --git a/src/core/ob.js b/src/core/ob.js index 7bafa8a1e..d875389e2 100644 --- a/src/core/ob.js +++ b/src/core/ob.js @@ -28,10 +28,10 @@ * @class BI.OB * @abstract */ - BI.OB = function (config) { + BI.OB = BI.OB || function (config) { this._constructor(config); }; - _.extend(BI.OB.prototype, { + _.defaults(BI.OB.prototype, { props: {}, init: null, destroyed: null, @@ -184,4 +184,4 @@ this.purgeListeners(); } }); -})(); \ No newline at end of file +})(); diff --git a/src/core/platform/web/dom.js b/src/core/platform/web/dom.js index 82f84641a..ad08cfba3 100644 --- a/src/core/platform/web/dom.js +++ b/src/core/platform/web/dom.js @@ -3,7 +3,7 @@ * @type {{}} */ !(function () { - BI.DOM = {}; + BI.DOM = BI.DOM || {}; BI.extend(BI.DOM, { ready: function (fn) { diff --git a/src/core/plugin.js b/src/core/plugin.js index 5938feb17..31d460d16 100644 --- a/src/core/plugin.js +++ b/src/core/plugin.js @@ -5,7 +5,7 @@ BI.Plugin = BI.Plugin || {}; var _ConfigPlugin = {}; var _GlobalWidgetConfigFns = []; var __GlobalObjectConfigFns = []; - BI.extend(BI.Plugin, { + BI.defaults(BI.Plugin, { getWidget: function (type, options) { if (_GlobalWidgetConfigFns.length > 0) { diff --git a/src/core/shortcut.js b/src/core/shortcut.js index 7f2717850..9ab6d3768 100644 --- a/src/core/shortcut.js +++ b/src/core/shortcut.js @@ -1,6 +1,6 @@ (function () { var kv = {}; - BI.shortcut = BI.component = function (xtype, cls) { + BI.shortcut = BI.component = BI.shortcut || function (xtype, cls) { if (kv[xtype] != null) { _global.console && console.error("shortcut:[" + xtype + "] has been registed"); } @@ -24,7 +24,7 @@ return widget; }; - BI.createWidget = function (item, options, context) { + BI.createWidget = BI.createWidget || function (item, options, context) { // 先把准备环境准备好 BI.init(); var el, w; @@ -71,7 +71,7 @@ throw new Error("无法根据item创建组件"); }; - BI.createElement = function () { + BI.createElement = BI.createElement || function () { var widget = BI.createWidget.apply(this, arguments); return widget.element; }; diff --git a/src/core/widget.js b/src/core/widget.js index e5dbbe0fc..df65ba7fd 100644 --- a/src/core/widget.js +++ b/src/core/widget.js @@ -7,7 +7,7 @@ */ !(function () { - BI.Widget = BI.inherit(BI.OB, { + BI.Widget = BI.Widget || BI.inherit(BI.OB, { _defaultConfig: function () { return BI.extend(BI.Widget.superclass._defaultConfig.apply(this), { root: false, @@ -545,4 +545,4 @@ } return widget._mount(true, false, false, predicate); }; -})(); \ No newline at end of file +})();