Skip to main content
The
script only modifies the current configuration copy and does not directly modify the original subscription text.

生成一个符合 YumeBox 运行时约束的 JavaScript 覆写

Execution process

1

Initialize runtime

Initializes the JavaScript runtime and built-in methods the first time a .js file appears in the current override chain.
2

Pass in configuration object

The current configuration is converted to a JavaScript object and passed in as the profile parameter.
3

execute main

The script can modify profile directly or return a new configuration object. Both synchronous return values ​​and completed Promises are supported.
4

Check return value

The return value must be convertible to a JSON object. Script errors, missing main, or returning non-object values ​​will stop the current override chain.
The same override chain reuses the JavaScript runtime, but each script executes in an isolated scope; the main, variables, and declarations of the previous script are not leaked to the next script.

main(profile)

Minimal script

最小覆写.js

Modify fields

修改字段.js

expected diff

修改字段 diff.js
// [!code --] and // [!code ++] are only used for diff display in documentation and are legal JavaScript comments themselves.

Condition modification

按模式修改.js

Asynchronous script

异步 main.js
Promise must eventually complete; it will return async main(profile) did not settle when it is pending.

Return value requirements

Error example:
错误的返回值.js
If profile.rules is an array, the script will fail instead of continuing with the array as a complete configuration.
Last modified on August 13, 2026