Skip to content

Commit

Permalink
doc: demo.js
Browse files Browse the repository at this point in the history
  • Loading branch information
xream committed Dec 24, 2024
1 parent 74be1e3 commit 9ccd6b3
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions scripts/demo.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,20 @@ function operator(proxies = [], targetPlatform, context) {

// 若不存在 `source._collection`, 说明输出结果为单条订阅, 脚本设置在此单条订阅上

// 这个历史遗留原因, 是有点复杂. 提供一个例子, 用来取当前脚本所在的组合订阅或单条订阅名称

// let name = ''
// for (const [key, value] of Object.entries(env.source)) {
// if (!key.startsWith('_')) {
// name = value.displayName || value.name
// break
// }
// }
// if (!name) {
// const collection = env.source._collection
// name = collection.displayName || collection.name
// }

// 1. 输出单条订阅 sub-1 时, 该单条订阅中的脚本上下文为:
// {
// "source": {
Expand Down

0 comments on commit 9ccd6b3

Please sign in to comment.