obsidian/components/monkey-around-component
Improved type-safe wrapper of https://www.npmjs.com/package/monkey-around library.
Classes
Section titled “Classes”| Class | Description |
|---|---|
| MonkeyAroundComponent | A component that manages monkey-patches with lifecycle-bound cleanup. All patches registered via this component are automatically uninstalled when the component unloads. |
Interfaces
Section titled “Interfaces”| Interface | Description |
|---|---|
| MonkeyAroundComponentRegisterFunctionPatchParams | Parameters passed to MonkeyAroundComponent#registerFunctionPatch. |
| MonkeyAroundComponentRegisterMethodPatchParams | Parameters passed to MonkeyAroundComponent#registerMethodPatch. |
| PatchHandlerParams | Parameters passed to a PatchHandlerFn callback. |
| PostPatchHandlerParams | Parameters passed to a PostPatchHandlerFn callback. |
Functions
Section titled “Functions”| Function | Description |
|---|---|
| around | Applies a patch to the object. Better strongly-typed version of monkey-around. |
| hasPatchToken | Checks if a function has a specific patch token. |
| Type | Description |
|---|---|
| Factories | A type of the factories to apply to the object. |
| FunctionKeys | Keys of Obj whose value is callable — a method, or a function-like object such as a Debouncer. These are the members accepted by MonkeyAroundComponent#registerFunctionPatch. |
| MethodKeys | Keys of Obj whose value is a plain function (a “real method”). Function-like objects that carry extra members are excluded — e.g. a Debouncer (which adds cancel/run) belongs to MonkeyAroundComponent#registerFunctionPatch, not MonkeyAroundComponent#registerMethodPatch. The check is whether the member has any own keys beyond a bare function’s (Exclude<keyof T, keyof GenericFunction> is never). |
| PatchHandlerFn | A patch handler function that intercepts calls to a method on an object. |
| PostPatchHandlerFn | A post-patch handler function that runs after a patch is applied. |