【问题标题】:Use Closure Library inside Chrome DevTools在 Chrome DevTools 中使用闭包库
【发布时间】:2012-09-19 07:48:43
【问题描述】:

我已经检查了 Closure 库 as instructred,但找不到在控制台中使用该库的方法(即 goog.require('math') 只是为了尝试和测试目的。

提前致谢。

【问题讨论】:

    标签: javascript google-chrome google-chrome-devtools google-closure google-closure-library


    【解决方案1】:

    加载 Closure 库的 base.js 后,您可以在 Chrome 开发工具控制台中引用该库。

    closure-test.html(加载 base.js)

    <!doctype html>
    <html>
    <head>
      <title>Closure Library Test</title>
      <script src="http://closure-library.googlecode.com/svn/trunk/closure/goog/base.js"></script>
    </head>
    
    <body>
    <h1>Closure Library Test</h1>
    
    </body>
    </html>
    

    Chrome 开发工具控制台

    > goog.require('goog.math');
    <* undefined
    

    观察Resources | Frames | (closure-test.html) | Scripts,math.js 将被加载。

    > goog.math.modulo(-1, 8);
    <* 7
    

    【讨论】:

    • 谢谢!这样做了,但现在我得到 goog.require 找不到:数学
    猜你喜欢
    • 2015-07-29
    • 2020-03-04
    • 2019-08-13
    • 1970-01-01
    • 2015-10-29
    • 2013-09-01
    • 1970-01-01
    • 2013-07-20
    • 2011-10-02
    相关资源
    最近更新 更多