Skip to content

Commit

Permalink
feat: 新增expand-app装饰器
Browse files Browse the repository at this point in the history
  • Loading branch information
Yan Heng committed Jul 20, 2023
1 parent c617742 commit c38cc8a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
9 changes: 9 additions & 0 deletions packages/core/src/decorators/expand-app.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { App } from '../app';
import { Plugin } from '../types';

export function expandApp<T extends Plugin = Plugin>(methodName?: string) {
return function (target: T, propertyKey: string, descriptor: PropertyDescriptor) {
methodName = methodName ?? propertyKey;
Reflect.set(App.prototype, methodName, descriptor.value);
};
}
1 change: 1 addition & 0 deletions packages/core/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
export * from './app';
export * from './types';
export * from './decorators/expand-app';

0 comments on commit c38cc8a

Please sign in to comment.