From 009a10d5d3d1f476cc8786aff0f2ee01ba43274a Mon Sep 17 00:00:00 2001 From: iapyang Date: Sat, 8 May 2021 15:19:33 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E7=B1=BB=E5=9E=8B=E8=A1=A5=E5=85=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- typescript/base/base.ts | 7 +++++++ typescript/core/controller/controller.broadcast.ts | 9 +++++++++ typescript/index.ts | 6 ++++++ 3 files changed, 22 insertions(+) create mode 100644 typescript/base/base.ts create mode 100644 typescript/core/controller/controller.broadcast.ts diff --git a/typescript/base/base.ts b/typescript/base/base.ts new file mode 100644 index 0000000000..b6dfd42405 --- /dev/null +++ b/typescript/base/base.ts @@ -0,0 +1,7 @@ +import { LayerController } from "../core/controller/controller.layer"; +import { BroadcastController } from "../core/controller/controller.broadcast"; + +export type Layers = LayerController; + +export type Broadcasts = BroadcastController; + diff --git a/typescript/core/controller/controller.broadcast.ts b/typescript/core/controller/controller.broadcast.ts new file mode 100644 index 0000000000..3b5bf68e1a --- /dev/null +++ b/typescript/core/controller/controller.broadcast.ts @@ -0,0 +1,9 @@ +import { Controller } from './controller'; + +export declare class BroadcastController extends Controller { + on(name: string, fn: Function): Function; + + send(name: string, ...args: any[]): void; + + remove(name: string, fn: Function): this; +} diff --git a/typescript/index.ts b/typescript/index.ts index 432b9d93bd..34afc93a29 100644 --- a/typescript/index.ts +++ b/typescript/index.ts @@ -161,6 +161,8 @@ import { FloatHorizontalLayout } from "./core/wrapper/layout/adapt/float.horizon import { AdaptiveLayout } from "./core/wrapper/layout/layout.adaptive"; import { HexColorChooserPopup } from './case/colorchooser/colorchooser.popup.hex'; import { BlankIconTextItem } from './base/single/button/listitem/blankicontextitem'; +import { Broadcasts, Layers } from "./base/base"; +import { BroadcastController } from "./core/controller/controller.broadcast"; export interface BI extends _func, _i18n, _base, _inject, _var, _web, _utils { @@ -179,7 +181,10 @@ export interface BI extends _func, _i18n, _base, _inject, _var, _web, _utils { ActionFactory: typeof ActionFactory; ShowAction: typeof ShowAction; Controller: typeof Controller; + Layers: Layers; LayerController: typeof LayerController; + Broadcasts: Broadcasts; + BroadcastController: typeof BroadcastController; Behavior: typeof Behavior; BehaviorFactory: typeof BehaviorFactory; HighlightBehavior: typeof HighlightBehavior; @@ -371,6 +376,7 @@ export { ShowAction, Controller, LayerController, + BroadcastController, Behavior, BehaviorFactory, RedMarkBehavior,