From 9781752afe11f9cf8b794153d2df6c5ac8939232 Mon Sep 17 00:00:00 2001 From: zsmj1994 Date: Mon, 6 Jul 2020 11:17:53 +0800 Subject: [PATCH] =?UTF-8?q?=E6=97=A0JIRA=20chore:=20=E5=A2=9E=E5=8A=A0BI.P?= =?UTF-8?q?lugin=E6=8F=8F=E8=BF=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- typescript/core/plugin.ts | 16 ++++++++++++++++ typescript/index.ts | 2 ++ 2 files changed, 18 insertions(+) create mode 100644 typescript/core/plugin.ts diff --git a/typescript/core/plugin.ts b/typescript/core/plugin.ts new file mode 100644 index 000000000..cbd1da1d9 --- /dev/null +++ b/typescript/core/plugin.ts @@ -0,0 +1,16 @@ +import {_Widget} from "./widget"; + +type configWidgetFn = (options: object) => object +type configObjectFn = (widget: _Widget) => void + +export type _config = (widgetFunction: configWidgetFn | configWidgetFn[], objectFunction: configObjectFn | configObjectFn[]) => void + +export type _configWidget = (shorcut: string, widgetFunction: configWidgetFn) => void + +export type _registerObject = (shorcut: string, objectFunction: configObjectFn) => void + +export type _Plugin = { + config: _config; + configWidget: _configWidget; + registerObject: _registerObject; +} diff --git a/typescript/index.ts b/typescript/index.ts index 79c7605d6..a9243f40c 100644 --- a/typescript/index.ts +++ b/typescript/index.ts @@ -33,6 +33,7 @@ import { _RedMarkBehavior } from "./core/behavior/behavior.redmark"; import * as decorator from "./core/decorator/decorator"; import { _func } from "./core/func"; import { _i18n } from "./core/i18n"; +import { _Plugin } from "./core/plugin"; import { _OB } from "./core/ob"; import { _Widget, _WidgetStatic } from "./core/widget"; import { _Layout } from "./core/wrapper/layout"; @@ -50,6 +51,7 @@ type ClassConstructor = T & { export interface BI extends _func, _i18n, _base { OB: ClassConstructor<_OB>; + Plugin:_Plugin; Widget: ClassConstructor<_Widget> & _WidgetStatic; Single: ClassConstructor<_Single>; BasicButton: ClassConstructor<_BasicButton> & _BasicButtonStatic;