谷歌闭包编译器和历史API

google closure compiler and history API

本文关键字:历史 API 编译器 闭包 谷歌      更新时间:2023-09-26

我有这段代码,我正在高级编译模式下通过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) {

我需要在代码中更改什么才能使其在没有警告的情况下通过?

谢谢

您必须设置 addEventListener 的 useCapture 变量。

这可能是您想要的:

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