Add ESLint config and update code style
Introduced a new eslint.config.js using neostandard and added related devDependencies. Updated codebase for consistent formatting, spacing, and function declarations. Minor refactoring and cleanup across multiple files to improve readability and maintain code style compliance.
This commit is contained in:
1 parent
1990761ad6
commit
fa80441e36
42 files changed
+628
-580
No files matched your search
@@ -50,7 +50,6 @@ export class NativePacketHandler {
|
||||
this.logger.logError('NativePacketClient 加载出错:', error);
|
||||
this.loaded = false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { TypedEventEmitter } from "./typeEvent";
|
||||
import { TypedEventEmitter } from './typeEvent';
|
||||
|
||||
export interface AppEvents {
|
||||
'event:emoji_like': { groupId: string; senderUin: string; emojiId: string, msgSeq: string, isAdd: boolean,count:number };
|
||||
'event:emoji_like': { groupId: string; senderUin: string; emojiId: string, msgSeq: string, isAdd: boolean, count: number };
|
||||
}
|
||||
export const appEvent = new TypedEventEmitter<AppEvents>();
|
||||
export const appEvent = new TypedEventEmitter<AppEvents>();
|
||||
@@ -1,28 +1,28 @@
|
||||
import "reflect-metadata";
|
||||
import { Container, injectable } from "inversify";
|
||||
import { NapCatCore } from "../..";
|
||||
import { TypedEventEmitter } from "./typeEvent";
|
||||
import 'reflect-metadata';
|
||||
import { Container, injectable } from 'inversify';
|
||||
import { NapCatCore } from '../..';
|
||||
import { TypedEventEmitter } from './typeEvent';
|
||||
|
||||
export const container = new Container();
|
||||
|
||||
export const ReceiverServiceRegistry = new Map<string, new (...args: any[]) => ServiceBase>();
|
||||
|
||||
export abstract class ServiceBase {
|
||||
get core(): NapCatCore {
|
||||
return container.get(NapCatCore);
|
||||
}
|
||||
get event() {
|
||||
return container.get(TypedEventEmitter);
|
||||
}
|
||||
get core (): NapCatCore {
|
||||
return container.get(NapCatCore);
|
||||
}
|
||||
|
||||
abstract handler(seq: number, hex_data: string): Promise<void> | void;
|
||||
get event () {
|
||||
return container.get(TypedEventEmitter);
|
||||
}
|
||||
|
||||
abstract handler (seq: number, hex_data: string): Promise<void> | void;
|
||||
}
|
||||
|
||||
export function ReceiveService(serviceName: string) {
|
||||
return function <T extends new (...args: any[]) => ServiceBase>(constructor: T) {
|
||||
injectable()(constructor);
|
||||
ReceiverServiceRegistry.set(serviceName, constructor);
|
||||
return constructor;
|
||||
};
|
||||
export function ReceiveService (serviceName: string) {
|
||||
return function <T extends new (...args: any[]) => ServiceBase>(constructor: T) {
|
||||
injectable()(constructor);
|
||||
ReceiverServiceRegistry.set(serviceName, constructor);
|
||||
return constructor;
|
||||
};
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user