优化消息判断

This commit is contained in:
cool 2024-03-22 12:08:16 +08:00
parent 5c17142969
commit 61a25cc214
3 changed files with 4 additions and 3 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "@cool-midway/core", "name": "@cool-midway/core",
"version": "7.1.12", "version": "7.1.13",
"description": "", "description": "",
"main": "dist/index.js", "main": "dist/index.js",
"typings": "index.d.ts", "typings": "index.d.ts",

View File

@ -154,7 +154,8 @@ export class CoolEventManager extends Events {
*/ */
async globalEvent() { async globalEvent() {
process.on("message", async (message: any) => { process.on("message", async (message: any) => {
const data = message.data; const data = message?.data;
if (!data) return;
if (data.type != `${COOL_EVENT_MESSAGE}@${this.keys}`) return; if (data.type != `${COOL_EVENT_MESSAGE}@${this.keys}`) return;
await this.doAction(message); await this.doAction(message);
}); });

View File

@ -1,6 +1,6 @@
{ {
"name": "@cool-midway/core", "name": "@cool-midway/core",
"version": "7.1.12", "version": "7.1.13",
"description": "", "description": "",
"main": "index.js", "main": "index.js",
"typings": "index.d.ts", "typings": "index.d.ts",