surrogate
Version:
Object method hooks made easy
23 lines (22 loc) • 1.11 kB
TypeScript
import type { SurrogateOptions } from '../interfaces';
import { Which, HookType } from '../which';
import { Constructor, SurrogateDecorateOptions, SurrogateDecoratorOptions } from './interfaces';
interface DecoratedEventMap {
[key: string]: DecoratorContainer;
}
interface DecoratorContainer {
[HookType.PRE]: SurrogateDecoratorOptions<any>[];
[HookType.POST]: SurrogateDecoratorOptions<any>[];
}
export declare class SurrogateClassWrapper<T extends Function> implements ProxyHandler<T> {
private options;
static decoratorMap: Map<Function, DecoratedEventMap>;
constructor(options: SurrogateDecorateOptions<T>);
construct(Klass: T, args: any[], Target: any): import("../interfaces").Surrogate<T>;
private applyDecorators;
private registerHandlers;
static wrap<T extends Function>(klass: T, options: SurrogateOptions): T;
static addDecorators<T extends object>(klass: Constructor<T>, type: Which, event: string, surrogateDecoratorOptions: SurrogateDecoratorOptions<any>[]): Map<Function, DecoratedEventMap>;
private static retrieveTargetDecoratorMap;
}
export {};