1
mirror of https://github.com/revanced/revanced-patcher synced 2024-11-24 05:16:22 +01:00

Update 4_apis.md

This commit is contained in:
oSumAtrIX 2024-10-27 05:31:11 +01:00 committed by GitHub
parent f338ebff6c
commit 242e244b18
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -14,7 +14,7 @@ A handful of APIs are available to make patch development easier and more effici
#### 👹 `proxy(ClassDef)`
By default, the classes are immutable, meaning that they cannot be modified.
By default, the classes are immutable, meaning they cannot be modified.
To make a class mutable, use the `proxy(ClassDef)` function.
This function creates a lazy mutable copy of the class definition.
Accessing the property will replace the original class definition with the mutable copy,
@ -52,11 +52,11 @@ execute {
// stop() returns the mutable copy of the method.
val method = navigate(someMethod).at(2) { instruction -> instruction.opcode == Opcode.INVOKEVIRTUAL }.stop()
// Alternatively to stop(), you can delegeate the method to a variable.
// Alternatively, to stop(), you can delegate the method to a variable.
val method by navigate(someMethod).at(1)
// You can chain multiple calls to at() to navigate deeper into the method.
val method = navigate(someMethod).at(1).at(2, 3, 4).at(5).stop()
val method by navigate(someMethod).at(1).at(2, 3, 4).at(5)
}
```
@ -72,7 +72,7 @@ execute {
}
```
The `delete` function can be used to mark files for deletion when the APK is rebuilt.
The `delete` function can mark files for deletion when the APK is rebuilt.
```kt
execute {