GithubHelp home page GithubHelp logo

Comments (5)

zZPiglet avatar zZPiglet commented on June 19, 2024

e8f3b89

已修改,我没有 Shadowrocket 及 Stash,烦请测试,谢谢!

from task.

chengkongyiban avatar chengkongyiban commented on June 19, 2024

e8f3b89

已修改,我没有 Shadowrocket 及 Stash,烦请测试,谢谢!

以下是刚刚测试的日志,我注意到$environment.system依然在😂

Can't find variable: $environment in method global code@ line: 16, column: 49

from task.

chengkongyiban avatar chengkongyiban commented on June 19, 2024

e8f3b89

已修改,我没有 Shadowrocket 及 Stash,烦请测试,谢谢!

佬,帮忙改一下吧,😫,

from task.

zZPiglet avatar zZPiglet commented on June 19, 2024

很抱歉,没有 Shadowrocket,无法进行进一步测试。如果真的有此报错,大概率是 Shadowrocket 自身问题。node 和浏览器的 JavaScript 控制台也没有 $environment 接口,这次的写法和之前的写法均不会引起报错。&& 在 JavaScript 中从左至右有短路运算,第一个表达式返回 false 之后理应直接返回 false(参考: MDN)。之前写法中 Shadowrocket 的通知接口第四个参数有误,已进行修改。

你说的问题可以直接通过:

const isQuanX = typeof $notify != "undefined";
const isSurgeiOS1 =
    typeof $utils != "undefined" &&
    $environment["surge-version"] &&
    $environment.system == "iOS";
const isSurgeiOS2 =
    "undefined" !== typeof $environment &&
    $environment["surge-version"] &&
    $environment.system == "iOS";
const isLooniOS = typeof $loon != "undefined" && /iPhone/.test($loon);
const isStashiOS =
    "undefined" !== typeof $environment &&
    $environment["stash-version"] &&
    $environment.system == "iOS";
const isShadowrocket = "undefined" !== typeof $rocket;
const isLanceX = "undefined" != typeof $native;

const platform = {isQuanX, isSurgeiOS1, isSurgeiOS2, isLooniOS, isStashiOS, isShadowrocket, isLanceX}
console.log(JSON.stringify(platform))

$done()

进行测试,其中 isSurgeiOS1 是老的写法,isSurgeiOS2 是新的写法,这段代码在 Surge 和 Quantumult X 中均未报错,删除 $done() 后在 node 和 MDN 中运行也未报错。

from task.

chengkongyiban avatar chengkongyiban commented on June 19, 2024

很抱歉,没有 Shadowrocket,无法进行进一步测试。如果真的有此报错,大概率是 Shadowrocket 自身问题。node 和浏览器的 JavaScript 控制台也没有 $environment 接口,这次的写法和之前的写法均不会引起报错。&& 在 JavaScript 中从左至右有短路运算,第一个表达式返回 false 之后理应直接返回 false(参考: MDN)。之前写法中 Shadowrocket 的通知接口第四个参数有误,已进行修改。

你说的问题可以直接通过:

const isQuanX = typeof $notify != "undefined";

const isSurgeiOS1 =

    typeof $utils != "undefined" &&

    $environment["surge-version"] &&

    $environment.system == "iOS";

const isSurgeiOS2 =

    "undefined" !== typeof $environment &&

    $environment["surge-version"] &&

    $environment.system == "iOS";

const isLooniOS = typeof $loon != "undefined" && /iPhone/.test($loon);

const isStashiOS =

    "undefined" !== typeof $environment &&

    $environment["stash-version"] &&

    $environment.system == "iOS";

const isShadowrocket = "undefined" !== typeof $rocket;

const isLanceX = "undefined" != typeof $native;



const platform = {isQuanX, isSurgeiOS1, isSurgeiOS2, isLooniOS, isStashiOS, isShadowrocket, isLanceX}

console.log(JSON.stringify(platform))



$done()

进行测试,其中 isSurgeiOS1 是老的写法,isSurgeiOS2 是新的写法,这段代码在 Surge 和 Quantumult X 中均未报错,删除 $done() 后在 node 和 MDN 中运行也未报错。

刚刚测试了最新的Unblock脚本 小火箭已经可以使用了。谢谢大佬解答

from task.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.