@ne1410s/codl
Version:
Indulge your apps with codl: a component model library
27 lines (26 loc) • 1.04 kB
TypeScript
import { Ctor, FunctionDecorator, TypedPropertyDecorator } from '../types';
export declare abstract class Interception {
/**
* Calls a custom function each with new instance created.
* @param fn A custom function.
*/
static readonly init: <T>(fn: (o: any) => void) => (c: Ctor<T>) => Ctor<any>;
/**
* Provides an initial / default value.
* @param val The initial value.
*/
static readonly initial: <T>(val: T) => TypedPropertyDecorator<T>;
/**
* Intercepts the input of a function, preventing its execution.
* @param fn A custom function.
* @returns The result of the custom function.
*/
static readonly input: (fn: (args: any[], o: any) => any) => FunctionDecorator;
/**
* Intercepts the output of a function, after it is executed.
* @param fn A custom function.
* @returns The result of the custom function.
*/
static readonly output: <T>(fn: (val: T, args: any[], o: any) => T) => FunctionDecorator;
private static readonly expose;
}