typeioc

Home > typeioc > IInterceptor > intercept

IInterceptor.intercept() method

Create a subject with members substituted by given parameters. For the instances of an object - interceptInstance method is used, for prototypical/constructible functions - interceptPrototype is used

Signature:

intercept<R extends Function | Object>(subject: R, substitutes?: ISubstituteInfo | ISubstituteInfo[]): R;

Parameters

Parameter Type Description
subject R prototypical/constructable function or an instance of an abject
substitutes ISubstituteInfo | ISubstituteInfo[] instance(s) of ISubstituteInfo interface

Returns:

R