F

before

Runs a callback before a method, which can replace its arguments by returning an array.

function before<M extends PatchParent, P extends string>(parent: M, method: P, callback: BeforeCallback<ArgsOf<M[P]>, ResultOf<M[P]>, SelfOf<M, M[P]>>, options?: PatchOptions): () => void

Parameters

NameTypeDescription
parentM

The object holding the method.

methodP

The method's key.

callbackBeforeCallback<ArgsOf<M[P]>, ResultOf<M[P]>, SelfOf<M, M[P]>>

Receives the patch context.

options?PatchOptions

Patch options.

Returns

() => void

A function removing the patch.