mirror of
https://github.com/cool-team-official/cool-admin-midway.git
synced 2024-11-01 22:20:30 +08:00
优化插件初始化方式
This commit is contained in:
parent
c6e660713b
commit
66a21e97b2
@ -21,9 +21,12 @@ export class BaseAppEvent {
|
|||||||
@Inject()
|
@Inject()
|
||||||
cacheManager: CacheManager;
|
cacheManager: CacheManager;
|
||||||
|
|
||||||
|
@Inject()
|
||||||
|
pluginCenterService: PluginCenterService;
|
||||||
|
|
||||||
@Event('onServerReady')
|
@Event('onServerReady')
|
||||||
async onServerReady() {
|
async onServerReady() {
|
||||||
await this.cacheManager.set(PLUGIN_CACHE_KEY, []);
|
await this.cacheManager.set(PLUGIN_CACHE_KEY, []);
|
||||||
this.app.getApplicationContext().getAsync(PluginCenterService);
|
this.pluginCenterService.init();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -45,7 +45,10 @@ export class PluginCenterService {
|
|||||||
@Inject()
|
@Inject()
|
||||||
coolEventManager: CoolEventManager;
|
coolEventManager: CoolEventManager;
|
||||||
|
|
||||||
@Init()
|
/**
|
||||||
|
* 初始化
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
async init() {
|
async init() {
|
||||||
const inits: any[] = (await this.cacheManager.get(PLUGIN_CACHE_KEY)) || [];
|
const inits: any[] = (await this.cacheManager.get(PLUGIN_CACHE_KEY)) || [];
|
||||||
const pid = process.pid;
|
const pid = process.pid;
|
||||||
|
Loading…
Reference in New Issue
Block a user