From 5a8dd144bda98bb34bb355117f7f443b067cb80f Mon Sep 17 00:00:00 2001 From: windy <1374721899@qq.com> Date: Wed, 2 Dec 2020 11:45:22 +0800 Subject: [PATCH] =?UTF-8?q?=E6=97=A0JIRA=E4=BB=BB=E5=8A=A1=20BI.config?= =?UTF-8?q?=E6=8F=90=E4=BE=9Bimmdiate=E5=8F=82=E6=95=B0=E6=9D=A5=E7=AB=8B?= =?UTF-8?q?=E5=8D=B3=E6=89=A7=E8=A1=8C=E5=9B=9E=E8=B0=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/core/inject.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/core/inject.js b/src/core/inject.js index a549abf187..3549502581 100644 --- a/src/core/inject.js +++ b/src/core/inject.js @@ -49,6 +49,22 @@ var configFunctions = {}; BI.config = BI.config || function (type, configFn, opt) { + if (opt && opt.immediate) { + if (constantInjection[type]) { + return (constantInjection[type] = configFn(constantInjection[type])); + } + if (providerInjection[type]) { + if (!providers[type]) { + providers[type] = new providerInjection[type](); + } + // 如果config被重新配置的话,需要删除掉之前的实例 + if (providerInstance[type]) { + delete providerInstance[type]; + } + return configFn(providers[type]); + } + return BI.Plugin.configWidget(type, configFn, opt); + } if (!configFunctions[type]) { configFunctions[type] = []; }