feat(shell): uix: implement UixEventEmitter

This commit is contained in:
Il Harper 2024-08-23 13:43:39 +08:00
parent 92133ce831
commit 23ace145ef
No known key found for this signature in database
GPG Key ID: 4B71FCA698E7E8EC

View File

@ -1,6 +1,35 @@
/* eslint-disable @typescript-eslint/no-unsafe-declaration-merging */
import { EventEmitter } from 'node:events'
import { api } from './api'
interface UixEventEmitter {
/**
*
*
* @param key
* @param listener
*/
on(key: string, listener: (value: string) => void): this
/**
*
* @param key
* @param listener
*/
once(key: string, listener: (value: string) => void): this
/**
*
*
* @param key
* @param value
*/
emit(key: string, value: string): boolean
}
class UixEventEmitter extends EventEmitter {}
const uinRegex = /\d+/
const isUin = (uin: unknown) =>
@ -12,7 +41,7 @@ const isUid = (uid: unknown) =>
const isGroup = isUin
export class Uix extends EventEmitter {
export class Uix extends UixEventEmitter {
map: Record<string, string> = {}
isUin = isUin