UNPKG

@turbox3d/command-manager

Version:

Large-scale productivity application command management library

20 lines (19 loc) 624 B
import { IConstructorOf } from '@turbox3d/shared'; import { Command } from './Command'; declare class INoParamCommand { apply(): void; active(): void; } declare class IParamCommand<P extends {}> { apply(param: P): void; active(param: P): void; } type LifeCircleClass<P extends {} = string> = P extends {} ? IParamCommand<P> : INoParamCommand; export type CommandType = Omit<Command, 'active' | 'apply'>; /** * 构建一个 Command 基类 * * 范型类型为激活时的函数参数 */ declare function create<P extends {} = string>(): IConstructorOf<LifeCircleClass<P> & CommandType>; export { create };