Search code examples
javascriptgoogle-closure-compilerhtml5-history

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


Solution

  • You have to set the useCapture variable of addEventListener.

    This is probably what you want:

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