12 |
- import React from'react';import Logger from'./Logger';class Systems{constructor(){this.CoreSystem=null,this.subSystems={core:null},this.modules={},this.services={}}setCore(a){return this.subSystems.core=a,this.CoreSystem=a,a.LinkManager.disableCore(),this.decorate('core',a.ModuleSystem),this.decorate('core',a.ServiceSystem),this.decorate('core',a.LinkManager),this.decorate('core',a.RoutingSystem),a}getCore(){return this.CoreSystem}addSystem(a){let b=a.id;return b?void(this.subSystems[b]=a,this.decorate(b,a.ModuleSystem),this.decorate(b,a.ServiceSystem),this.decorate(b,a.LinkManager),this.decorate(b,a.RoutingSystem)):void Logger.error('Cannot addSystem core.id is not defined!',a,b)}getSystem(a){return this.subSystems[a]}decorate(a,b){b.CoreSystem=this.subSystems[a],b.ModuleSystem=this.subSystems[a].ModuleSystem,b.ServiceSystem=this.subSystems[a].ServiceSystem,b.RoutingSystem=this.subSystems[a].RoutingSystem,b.LinkManager=this.subSystems[a].LinkManager}systemAdmin(a){// ?
- this.subSystems[a].LinkManager}addService(a){this.services[a.name]=a}addModule(a){this.modules[a.name]=a}addServices(a){for(let b in a)this.services[b]=a[b]}addModules(a){for(let b in a)this.modules[b]=a[b]}getModules(){return this.modules}getServices(){return this.services}}export default new Systems;
|