From a81b7bbbc4c14ce685c9cd0755bba4ab6a14b8a4 Mon Sep 17 00:00:00 2001 From: fangxiang Date: Wed, 11 Jan 2023 16:26:12 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=97=A0=E7=95=8CeventBus?= =?UTF-8?q?=E7=B1=BB=E5=9E=8B=E9=94=99=E8=AF=AF=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/store/index.ts | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/store/index.ts b/src/store/index.ts index 0fd0601..2ecab0c 100644 --- a/src/store/index.ts +++ b/src/store/index.ts @@ -39,9 +39,19 @@ export class CustomDefines { function_mirroring_output = false; } -export interface WuJieInterface { +export interface IWuJieEventBis { + $on(event: string, fn: Function): IWuJieEventBis; + /** 任何$emit都会导致监听函数触发,第一个参数为事件名,后续的参数为$emit的参数 */ + $onAll(fn: (event: string, ...args: Array) => any): IWuJieEventBis; + $once(event: string, fn: Function): void; + $off(event: string, fn: Function): IWuJieEventBis; + $offAll(fn: Function): IWuJieEventBis; + $emit(event: string, ...args: Array): IWuJieEventBis; + $clear(): IWuJieEventBis; +} +export interface IWuJieInterface { props: any; - bus: EventEmitter; + bus: IWuJieEventBis; } export interface StateInterface { @@ -86,7 +96,7 @@ export interface StateInterface { isLedPlayer: () => boolean; isSpecialVideo: () => boolean; - $wujie: WuJieInterface | null; + $wujie: IWuJieInterface | null; // selected_projector: string; EnableBlending: boolean; @@ -306,7 +316,6 @@ export const storeKey: InjectionKey> = import window_color_list from "./window_color_list.js"; import { EProductNames } from "src/entities/ProductNames"; -import EventEmitter from "events"; export const NullSignalSource = "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF";