代码之家  ›  专栏  ›  技术社区  ›  Isaac

“远程调试JS”在做什么?

  •  1
  • Isaac  · 技术社区  · 6 年前

    有人能解释一下,使用“Debug JS Remotely”运行应用程序的行为与不使用“Debug JS Remotely”运行应用程序的行为有何不同吗?目前,我的应用程序在这两种模式下的表现似乎有所不同。

    1 回复  |  直到 6 年前
        1
  •  6
  •   Matei Radu Ciaran George    6 年前

    您遇到的问题可能是由于所涉及的Javascript引擎不同:

    不同的环境可能表现不同。以下面这个例子为例 article :

    无需远程调试:

    new Date("2017-02-12 23:51:31")
      .toLocaleDateString('en-US', { day: '2-digit', month: 'short' })  // 02/12/17
    

    new Date("2017-02-12 23:51:31")
      .toLocaleDateString('en-US', { day: '2-digit', month: 'short' })  // Feb 12
    

    出于这个原因,我有时更喜欢使用一些本机特性的第三方实现(比如 whatwg-fetch 而不是使用本机获取)。


    资源:

        2
  •  0
  •   Rishi Sahu    5 年前

    您好,正如上面@Matei所解释的,您遇到的问题可能是由于涉及到不同的Javascript引擎 在我的例子中,代码在调试模式下运行良好,但当我离开调试模式屏幕时就卡住了

    So what worked for me was removing all the console.log from the file. So just remove all the console.log from your code and it will work like a charm.