@ -18,7 +18,7 @@ const moduleInjection = {}, moduleInjectionMap = {
export function module ( xtype , cls ) {
export function module ( xtype , cls ) {
if ( isNotNull ( moduleInjection [ xtype ] ) ) {
if ( isNotNull ( moduleInjection [ xtype ] ) ) {
_global . console && console . error ( ` module: [ ${ xtype } ] 已经注册过了 ` ) ;
_global . console && console . error ( ` module: [ ${ xtype } ] already registered ` ) ;
} else {
} else {
if ( isFunction ( cls ) ) {
if ( isFunction ( cls ) ) {
cls = cls ( ) ;
cls = cls ( ) ;
@ -48,7 +48,7 @@ export function module(xtype, cls) {
const constantInjection = { } ;
const constantInjection = { } ;
export function constant ( xtype , cls ) {
export function constant ( xtype , cls ) {
if ( isNotNull ( constantInjection [ xtype ] ) ) {
if ( isNotNull ( constantInjection [ xtype ] ) ) {
_global . console && console . error ( ` constant: [ ${ xtype } ]已经注册过了 ` ) ;
_global . console && console . error ( ` constant: [ ${ xtype } ]already registered ` ) ;
} else {
} else {
constantInjection [ xtype ] = cls ;
constantInjection [ xtype ] = cls ;
}
}
@ -59,7 +59,7 @@ export function constant(xtype, cls) {
const modelInjection = { } ;
const modelInjection = { } ;
export function model ( xtype , cls ) {
export function model ( xtype , cls ) {
if ( isNotNull ( modelInjection [ xtype ] ) ) {
if ( isNotNull ( modelInjection [ xtype ] ) ) {
_global . console && console . error ( ` model: [ ${ xtype } ] 已经注册过了 ` ) ;
_global . console && console . error ( ` model: [ ${ xtype } ] already registered ` ) ;
} else {
} else {
modelInjection [ xtype ] = cls ;
modelInjection [ xtype ] = cls ;
}
}
@ -70,7 +70,7 @@ export function model(xtype, cls) {
const storeInjection = { } ;
const storeInjection = { } ;
export function store ( xtype , cls ) {
export function store ( xtype , cls ) {
if ( isNotNull ( storeInjection [ xtype ] ) ) {
if ( isNotNull ( storeInjection [ xtype ] ) ) {
_global . console && console . error ( ` store: [ ${ xtype } ] 已经注册过了 ` ) ;
_global . console && console . error ( ` store: [ ${ xtype } ] already registered ` ) ;
} else {
} else {
storeInjection [ xtype ] = cls ;
storeInjection [ xtype ] = cls ;
}
}
@ -81,7 +81,7 @@ export function store(xtype, cls) {
const serviceInjection = { } ;
const serviceInjection = { } ;
export function service ( xtype , cls ) {
export function service ( xtype , cls ) {
if ( ( serviceInjection [ xtype ] ) ) {
if ( ( serviceInjection [ xtype ] ) ) {
_global . console && console . error ( ` service: [ ${ xtype } ] 已经注册过了 ` ) ;
_global . console && console . error ( ` service: [ ${ xtype } ] already registered ` ) ;
}
}
serviceInjection [ xtype ] = cls ;
serviceInjection [ xtype ] = cls ;
@ -92,7 +92,7 @@ export function service(xtype, cls) {
const providerInjection = { } ;
const providerInjection = { } ;
export function provider ( xtype , cls ) {
export function provider ( xtype , cls ) {
if ( ( providerInjection [ xtype ] ) ) {
if ( ( providerInjection [ xtype ] ) ) {
_global . console && console . error ( ` provider: [ ${ xtype } ] 已经注册过了 ` ) ;
_global . console && console . error ( ` provider: [ ${ xtype } ] already registered ` ) ;
} else {
} else {
providerInjection [ xtype ] = cls ;
providerInjection [ xtype ] = cls ;
}
}
@ -145,7 +145,7 @@ const runConfigFunction = (type, configFn) => {
}
}
}
}
if ( findVersion === true ) {
if ( findVersion === true ) {
_global . console && console . error ( ` moduleId: [ ${ module . moduleId } ] 接口 : [ ${ type } ] 接口版本 : [ ${ version } ] 已过期,版本要求为: ` , dependencies [ module . moduleId ] , "=>" , moduleInjection [ module . moduleId ] ) ;
_global . console && console . error ( ` moduleId: [ ${ module . moduleId } ] interface : [ ${ type } ] version : [ ${ version } ] has expired. The version requirement is: ` , dependencies [ module . moduleId ] , "=>" , moduleInjection [ module . moduleId ] ) ;
continue ;
continue ;
}
}
}
}
@ -245,7 +245,7 @@ export function point(type, action, pointFn, after) {
export const Modules = {
export const Modules = {
getModule ( type ) {
getModule ( type ) {
if ( ! moduleInjection [ type ] ) {
if ( ! moduleInjection [ type ] ) {
_global . console && console . error ( ` module: [ ${ type } ] 未定义 ` ) ;
_global . console && console . error ( ` module: [ ${ type } ] undefined ` ) ;
}
}
return moduleInjection [ type ] ;
return moduleInjection [ type ] ;
@ -258,7 +258,7 @@ export const Modules = {
export const Constants = {
export const Constants = {
getConstant ( type ) {
getConstant ( type ) {
if ( isNull ( constantInjection [ type ] ) ) {
if ( isNull ( constantInjection [ type ] ) ) {
_global . console && console . error ( ` constant: [ ${ type } ] 未定义 ` ) ;
_global . console && console . error ( ` constant: [ ${ type } ] undefined ` ) ;
}
}
runConfigFunction ( type ) ;
runConfigFunction ( type ) ;
@ -307,7 +307,7 @@ function callPoint(inst, types) {
export const Models = {
export const Models = {
getModel ( type , config ) {
getModel ( type , config ) {
if ( ! modelInjection [ type ] ) {
if ( ! modelInjection [ type ] ) {
_global . console && console . error ( ` model: [ ${ type } ] 未定义 ` ) ;
_global . console && console . error ( ` model: [ ${ type } ] undefined ` ) ;
}
}
runConfigFunction ( type ) ;
runConfigFunction ( type ) ;
const inst = new modelInjection [ type ] ( config ) ;
const inst = new modelInjection [ type ] ( config ) ;
@ -323,7 +323,7 @@ const stores = {};
export const Stores = {
export const Stores = {
getStore ( type , config ) {
getStore ( type , config ) {
if ( ! storeInjection [ type ] ) {
if ( ! storeInjection [ type ] ) {
_global . console && console . error ( ` store: [ ${ type } ] 未定义 ` ) ;
_global . console && console . error ( ` store: [ ${ type } ] undefined ` ) ;
}
}
if ( stores [ type ] ) {
if ( stores [ type ] ) {
return stores [ type ] ;
return stores [ type ] ;
@ -342,7 +342,7 @@ const services = {};
export const Services = {
export const Services = {
getService : ( type , config ) => {
getService : ( type , config ) => {
if ( ! serviceInjection [ type ] ) {
if ( ! serviceInjection [ type ] ) {
_global . console && console . error ( ` service: [ ${ type } ] 未定义 ` ) ;
_global . console && console . error ( ` service: [ ${ type } ] undefined ` ) ;
}
}
if ( services [ type ] ) {
if ( services [ type ] ) {
return services [ type ] ;
return services [ type ] ;
@ -359,7 +359,7 @@ const providers = {},
export const Providers = {
export const Providers = {
getProvider : ( type , config ) => {
getProvider : ( type , config ) => {
if ( ! providerInjection [ type ] ) {
if ( ! providerInjection [ type ] ) {
_global . console && console . error ( ` provider: [ ${ type } ] 未定义 ` ) ;
_global . console && console . error ( ` provider: [ ${ type } ] undefined ` ) ;
}
}
runConfigFunction ( type ) ;
runConfigFunction ( type ) ;
if ( ! providers [ type ] ) {
if ( ! providers [ type ] ) {
@ -398,7 +398,7 @@ export const Actions = {
const kv = { } ;
const kv = { } ;
export function shortcut ( xtype , cls ) {
export function shortcut ( xtype , cls ) {
if ( isNotNull ( kv [ xtype ] ) ) {
if ( isNotNull ( kv [ xtype ] ) ) {
_global . console && console . error ( ` 组件: [${ xtype } ] 已经注册过了 ` ) ;
_global . console && console . error ( ` widget: [${ xtype } ] already registered ` ) ;
}
}
if ( cls ) {
if ( cls ) {
cls . xtype = xtype ;
cls . xtype = xtype ;
@ -413,7 +413,7 @@ const createRealWidget = (config, context, lazy) => {
const Cls = isFunction ( config . type ) ? config . type : kv [ config . type ] ;
const Cls = isFunction ( config . type ) ? config . type : kv [ config . type ] ;
if ( ! Cls ) {
if ( ! Cls ) {
throw new Error ( ` 组件: [${ config . type } ] 未定义 ` ) ;
throw new Error ( ` widget: [${ config . type } ] undefined ` ) ;
}
}
let pushed = false ;
let pushed = false ;
const widget = new Cls ( ) ;
const widget = new Cls ( ) ;
@ -495,7 +495,7 @@ export function createWidget(item, options, context, lazy) {
if ( isWidget ( item . el ) ) {
if ( isWidget ( item . el ) ) {
return item . el ;
return item . el ;
}
}
throw new Error ( "组件:无法根据item创建组件 " , item ) ;
throw new Error ( "widget: Unable to create widget from item " , item ) ;
}
}
export function _lazyCreateWidget ( item , options , context ) {
export function _lazyCreateWidget ( item , options , context ) {
@ -524,5 +524,5 @@ export function getResource(type, config) {
if ( providerInjection [ type ] ) {
if ( providerInjection [ type ] ) {
return Providers . getProvider ( type , config ) ;
return Providers . getProvider ( type , config ) ;
}
}
throw new Error ( ` 未知类型: [ ${ type } ] 未定义 ` ) ;
throw new Error ( "unknown type: [" + type + "] undefined" ) ;
}
}