简体   繁体   中英

google closure compiler and history API

I have this code that I'm putting through the GCC in advanced compilation mode:

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

I get this message:

 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) {

What do I need to change in my code to make it pass without warning?

Thanks

You have to set the useCapture variable of addEventListener.

This is probably what you want:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM