JavaScript setTimeout 无递归无限循环
JavaScript setTimeout infinite loop without recursion
我不能使用 Obfuscator.io 来丑化我的 JS 脚本,因为它在一个调用自身的函数中包含一个 setTimeout
。
MCVE:
function repeater() {
// DO SOME STUFF...
setTimeout(repeater, 100);
}
repeater();
重现所需的自定义混淆设置:
- 标识符名称生成器:Mangled
- 保留名称:$ - jQuery
Obfuscator.io's 错误信息:
Error: @postConstruct error in class t: @postConstruct error in class t: Maximum call stack size exceeded
我已经阅读了一些关于此的其他 Stack Overflow 问题。 I understand that calling setTimeout(func)
inside func
is not actually recursion.
但是,Obfuscator.io's 算法仍然无法处理自调用 setTimeout
延迟。
如何使用 setTimeout
创建一个重复执行的函数而不在函数本身中调用它? 我不想使用 setInterval
因为我希望每次函数代码有 运行. setInterval
ignores that.[=25 后延迟开始=]
我认为你的问题实际上是在使用
- 保留名称:$ - jQuery
因为使用它作为配置结果
这就是您得到的结果,如果您将其更改为 ^$(网站上的文本框和描述应该如此),您的代码会很好地混淆
Reserved Names
Disables obfuscation and generation of identifiers, which being matched by passed RegExp patterns.
For instance, if you add ^someName
, the obfuscator will ensure that all variables, function names and function arguments that starts with someName will not get mangled.
我知道你有类似的东西:
function repeater() {
// DO SOME STUFF...
const someCodeInJQuery = $('#someId')
setTimeout(repeater, 100);
}
repeater();
只需更改为:
function repeater() {
// DO SOME STUFF...
const someCodeInJQuery = jQuery('#someId'); // Pay attention here
setTimeout(repeater, 100);
}
repeater();
Anwer: change $ to jQuery in your code, because obfuscator have
reserved words
Reccomendation: the best way - use uglifyJS instead of obfuscator
我不能使用 Obfuscator.io 来丑化我的 JS 脚本,因为它在一个调用自身的函数中包含一个 setTimeout
。
MCVE:
function repeater() {
// DO SOME STUFF...
setTimeout(repeater, 100);
}
repeater();
重现所需的自定义混淆设置:
- 标识符名称生成器:Mangled
- 保留名称:$ - jQuery
Obfuscator.io's 错误信息:
Error: @postConstruct error in class t: @postConstruct error in class t: Maximum call stack size exceeded
我已经阅读了一些关于此的其他 Stack Overflow 问题。 I understand that calling setTimeout(func)
inside func
is not actually recursion.
但是,Obfuscator.io's 算法仍然无法处理自调用 setTimeout
延迟。
如何使用 setTimeout
创建一个重复执行的函数而不在函数本身中调用它? 我不想使用 setInterval
因为我希望每次函数代码有 运行. setInterval
ignores that.[=25 后延迟开始=]
我认为你的问题实际上是在使用
- 保留名称:$ - jQuery
因为使用它作为配置结果
这就是您得到的结果,如果您将其更改为 ^$(网站上的文本框和描述应该如此),您的代码会很好地混淆
Reserved Names
Disables obfuscation and generation of identifiers, which being matched by passed RegExp patterns.
For instance, if you add
^someName
, the obfuscator will ensure that all variables, function names and function arguments that starts with someName will not get mangled.
我知道你有类似的东西:
function repeater() {
// DO SOME STUFF...
const someCodeInJQuery = $('#someId')
setTimeout(repeater, 100);
}
repeater();
只需更改为:
function repeater() {
// DO SOME STUFF...
const someCodeInJQuery = jQuery('#someId'); // Pay attention here
setTimeout(repeater, 100);
}
repeater();
Anwer: change $ to jQuery in your code, because obfuscator have reserved words
Reccomendation: the best way - use uglifyJS instead of obfuscator