F
instead
Runs a callback in place of a method, which can call ctx.original and replaces its result.
function instead<M extends PatchParent, P extends string>(parent: M, method: P, callback: InsteadCallback<ArgsOf<M[P]>, ResultOf<M[P]>, SelfOf<M, M[P]>>, options?: PatchOptions): () => voidParameters
| Name | Type | Description |
|---|---|---|
| parent | M | The object holding the method. |
| method | P | The method's key. |
| callback | InsteadCallback<ArgsOf<M[P]>, ResultOf<M[P]>, SelfOf<M, M[P]>> | Receives the patch context. |
| options? | PatchOptions | Patch options. |
Returns
() => voidA function removing the patch.