You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Since the API's original design mode of constructing a Hook only for a Class does not meet some exceptions, and there are some adaptability problems, so we make a new Hook code style is given below.
The following example
// Single Method Hook"com.demo.Test".toClass().method {
name ="test"
param(StringClass)
}.hook {
before {
// Do something...
}
after {
// Do something...
}
}
// Multiple Methods Hook"com.demo.Test".toClass().method {
name ="test"
}.all().hook {
before {
// Do something...
}
after {
// Do something...
}
}
// A Class with multiple Methods Hook"com.demo.Test".toClass().apply {
method {
name ="test"
param(StringClass)
}.hook {
before {
// Do something...
}
after {
// Do something...
}
}
method {
name ="another"
param(IntType)
}.hook {
before {
// Do something...
}
after {
// Do something...
}
}
}
Below is the current Hook code style.
The following example
// Single Method Hook"com.demo.Test".toClass().hook {
injectMember {
method {
name ="test"
param(StringClass)
}
beforeHook {
// Do something...
}
afterHook {
// Do something...
}
}
}
// Multiple Methods Hook"com.demo.Test".toClass().hook {
injectMember {
method {
name ="test"
}.all()
beforeHook {
// Do something...
}
afterHook {
// Do something...
}
}
}
// A Class with multiple Methods Hook"com.demo.Test".toClass().hook {
injectMember {
method {
name ="test"
param(StringClass)
}
beforeHook {
// Do something...
}
afterHook {
// Do something...
}
}
injectMember {
method {
name ="another"
param(IntType)
}
beforeHook {
// Do something...
}
afterHook {
// Do something...
}
}
}
新的 Hook 代码样式
这是一个提案。
由于 API 最初设计的仅针对一个 Class 构造一个 Hook 的模式不符合一些例外情况,也存在一些适配性问题,所以我们在下方给出了一种新的 Hook 代码样式。
示例如下
// 单一方法 Hook"com.demo.Test".toClass().method {
name ="test"
param(StringClass)
}.hook {
before {
// Do something...
}
after {
// Do something...
}
}
// 多重方法 Hook"com.demo.Test".toClass().method {
name ="test"
}.all().hook {
before {
// Do something...
}
after {
// Do something...
}
}
// 一个 Class 多个方法 Hook"com.demo.Test".toClass().apply {
method {
name ="test"
param(StringClass)
}.hook {
before {
// Do something...
}
after {
// Do something...
}
}
method {
name ="another"
param(IntType)
}.hook {
before {
// Do something...
}
after {
// Do something...
}
}
}
下方是现在采用的 Hook 代码样式。
示例如下
// 单一方法 Hook"com.demo.Test".toClass().hook {
injectMember {
method {
name ="test"
param(StringClass)
}
beforeHook {
// Do something...
}
afterHook {
// Do something...
}
}
}
// 多重方法 Hook"com.demo.Test".toClass().hook {
injectMember {
method {
name ="test"
}.all()
beforeHook {
// Do something...
}
afterHook {
// Do something...
}
}
}
// 一个 Class 多个方法 Hook"com.demo.Test".toClass().hook {
injectMember {
method {
name ="test"
param(StringClass)
}
beforeHook {
// Do something...
}
afterHook {
// Do something...
}
}
injectMember {
method {
name ="another"
param(IntType)
}
beforeHook {
// Do something...
}
afterHook {
// Do something...
}
}
}
The text was updated successfully, but these errors were encountered:
New Hook Code Style
This is a proposal.
Since the API's original design mode of constructing a Hook only for a
Class
does not meet some exceptions, and there are some adaptability problems, so we make a new Hook code style is given below.Below is the current Hook code style.
新的 Hook 代码样式
这是一个提案。
由于 API 最初设计的仅针对一个
Class
构造一个 Hook 的模式不符合一些例外情况,也存在一些适配性问题,所以我们在下方给出了一种新的 Hook 代码样式。下方是现在采用的 Hook 代码样式。
The text was updated successfully, but these errors were encountered: