【问题标题】:google closure compiler and history API谷歌闭包编译器和历史 API
【发布时间】:2012-05-15 00:44:05
【问题描述】:

我有这段代码,我在高级编译模式下通过 GCC:

window.addEventListener('popstate', function (event) { .... }

我收到这条消息:

 JSC_WRONG_ARGUMENT_COUNT: Function Window.prototype.addEventListener: called 
 with 2 argument(s). Function requires at least 3 argument(s) and no more than
 3 argument(s). at line 3601 character 0
 window.addEventListener('popstate', function (event) {

我需要在我的代码中进行哪些更改才能让它在没有警告的情况下通过?

谢谢

【问题讨论】:

    标签: javascript google-closure-compiler html5-history


    【解决方案1】:

    您必须设置 addEventListener 的 useCapture 变量。

    这可能就是你想要的:

    window.addEventListener('popstate', function(event) {...}, false);
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-06-18
      • 1970-01-01
      • 2013-02-12
      • 1970-01-01
      相关资源
      最近更新 更多