From 3542697746326781fdd3f32dbd95830ab4f54e2b Mon Sep 17 00:00:00 2001 From: snowgitea Date: Wed, 1 Jul 2026 17:56:59 +0800 Subject: [PATCH] chore: src/modules/plugin/event/app.ts --- src/modules/plugin/event/app.ts | 44 +++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 src/modules/plugin/event/app.ts diff --git a/src/modules/plugin/event/app.ts b/src/modules/plugin/event/app.ts new file mode 100644 index 0000000..2ef8f5c --- /dev/null +++ b/src/modules/plugin/event/app.ts @@ -0,0 +1,44 @@ +import { CoolEvent, Event } from '@cool-midway/core'; +import { CachingFactory, MidwayCache } from '@midwayjs/cache-manager'; +import { + App, + Config, + ILogger, + Inject, + InjectClient, + Logger, +} from '@midwayjs/core'; +import { IMidwayKoaApplication } from '@midwayjs/koa'; +import { PLUGIN_CACHE_KEY, PluginCenterService } from '../service/center'; +import { PluginTypesService } from '../service/types'; + +/** + * 插件事件 + */ +@CoolEvent() +export class PluginAppEvent { + @Logger() + coreLogger: ILogger; + + @Config('module') + config; + + @App() + app: IMidwayKoaApplication; + + @InjectClient(CachingFactory, 'default') + midwayCache: MidwayCache; + + @Inject() + pluginCenterService: PluginCenterService; + + @Inject() + pluginTypesService: PluginTypesService; + + @Event('onServerReady') + async onServerReady() { + await this.midwayCache.set(PLUGIN_CACHE_KEY, []); + this.pluginCenterService.init(); + // this.pluginTypesService.reGenerate(); + } +}