Skip to content

Commit 8e282dc

Browse files
committed
Update move-to-new-api documentation
1 parent 3edc7da commit 8e282dc

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

docs-source/src/en/guide/move-to-new-api.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,8 @@ afterHook {
136136
result = ...
137137
// Remove the content of the return value
138138
resultNull()
139+
// Get the data storage instance within the scope of the current callback method body
140+
dataExtra
139141
// Throw an exception to the Hook app
140142
Throwable("Fatal").throwToApp()
141143
// Execute the original method without hook and call with the original method parameters, generics can be omitted
@@ -174,6 +176,8 @@ override fun afterHookedMethod(param: MethodHookParam) {
174176
param.result = ...
175177
// Remove the content of the return value
176178
param.result = null
179+
// Get the data storage instance within the scope of the current callback method body
180+
param.extra
177181
// Throw an exception to the Hook app
178182
param.throwable = Throwable("Fatal")
179183
// Execute the original method without hooking

docs-source/src/zh-cn/guide/move-to-new-api.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,8 @@ afterHook {
136136
result = ...
137137
// 删除返回值内容
138138
resultNull()
139+
// 获取当前回调方法体范围内的数据存储实例
140+
dataExtra
139141
// 向 Hook APP 抛出异常
140142
Throwable("Fatal").throwToApp()
141143
// 执行未经 Hook 的原始方法并使用原始方法参数调用,泛型可略
@@ -174,6 +176,8 @@ override fun afterHookedMethod(param: MethodHookParam) {
174176
param.result = ...
175177
// 删除返回值内容
176178
param.result = null
179+
// 获取当前回调方法体范围内的数据存储实例
180+
param.extra
177181
// 向 Hook APP 抛出异常
178182
param.throwable = Throwable("Fatal")
179183
// 执行未经 Hook 的原始方法

0 commit comments

Comments
 (0)