patcher
namespace patcherFunctions
after<M extends PatchParent, P extends string>(parent: M, method: P, callback: AfterCallback<ArgsOf<M[P]>, ResultOf<M[P]>, SelfOf<M, M[P]>>, options?: PatchOptions): () => void
Runs a callback after a method, which can replace its result by returning a value.
Returns
A function removing the patch.
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
Runs a callback before a method, which can replace its arguments by returning an array.
Returns
A function removing the patch.
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): () => void
Runs a callback in place of a method, which can call ctx.original and replaces its result.
Returns
A function removing the patch.
unpatchAll(): void
Removes every patch.
unpatchAllByCaller(caller: string): void
Removes every patch made with a caller id.
Interfaces
A reference to a PatchParent that does not, by itself, prevent the parent from being garbage collected. Mirrors the subset of the global WeakRef API that the patcher uses.
PatchCallback(ctx: PatchContext<Args, Res, Self>): any
Types
An after callback, whose return value replaces the result unless it is undefined.
The context an after callback receives, with the result so far.
The arguments a patch receives for method F: its parameters, or its constructor's for a class.
A before callback, which can replace the arguments by returning an array.
The context a before callback receives.
An instead callback, whose return value becomes the result unless it is undefined.
The context an instead callback receives.
Whether T is any, so a patch on an untyped method or component keeps loose types.
An after callback, whose return value replaces the rendered tree unless it is undefined.
The context an after callback of patcher.react receives, with the rendered tree.
A before callback, which can replace a function component's props by returning new ones.
The context a patcher.react callback receives.
The callback a React patch of Kind takes, typed with the component's props and this.
An instead callback, whose return value is rendered in place of the component.
The context an instead callback of patcher.react receives.
One patcher.react hook: takes a memo, forwardRef or class component, or the object and key holding any component.
The patcher.react namespace: before, instead and after for React components.
A component patcher.react finds the render of by itself: a memo, a forwardRef or a class.
The props component C renders with.
The this component C renders with: a class component's instance, else undefined.
The result a patch receives for method F: its return value, or an instance for a class.
The this a patch receives: the method's declared this, else the object M holding it.
Variables
PATCH_SYMBOL: symbol
The symbol a patched method carries, pointing at its patch state.
Every module the patcher has patched, with its live patches.
PatchType: typeof PatchType
The kinds of patch: before, instead and after.
before, instead and after for React components. Each takes a memo, forwardRef or class component and
finds its render, or the object and key holding any component, which a plain function component needs.