From c04a9577af20fab5dd72028c1f09cf19990391ce Mon Sep 17 00:00:00 2001 From: cool Date: Wed, 21 Feb 2024 15:43:40 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=8F=92=E4=BB=B6=E5=88=9D?= =?UTF-8?q?=E5=A7=8B=E5=8C=96=E5=AE=8C=E6=88=90=E4=BA=8B=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/plugin/service/center.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/modules/plugin/service/center.ts b/src/modules/plugin/service/center.ts index 0ebfe22..0142005 100644 --- a/src/modules/plugin/service/center.ts +++ b/src/modules/plugin/service/center.ts @@ -15,9 +15,12 @@ import { Repository } from 'typeorm'; import { PluginInfo } from '../interface'; import * as _ from 'lodash'; import { CacheManager } from '@midwayjs/cache'; +import { CoolEventManager } from '@cool-midway/core'; export const PLUGIN_CACHE_KEY = 'PLUGIN_INIT'; +export const EVENT_PLUGIN_READY = 'EVENT_PLUGIN_READY'; + /** * 插件中心 */ @@ -39,6 +42,9 @@ export class PluginCenterService { @Inject() cacheManager: CacheManager; + @Inject() + coolEventManager: CoolEventManager; + @Init() async init() { const inits: any[] = (await this.cacheManager.get(PLUGIN_CACHE_KEY)) || []; @@ -48,6 +54,7 @@ export class PluginCenterService { await this.initHooks(); await this.initPlugin(); await this.cacheManager.set(PLUGIN_CACHE_KEY, inits.concat([process.pid])); + this.coolEventManager.emit(EVENT_PLUGIN_READY); } /**