Re: [dom] Make addEventListener throw for service worker optimization (#155)

> @@ -1065,6 +1065,15 @@ seen from the definition above, an <a>event listener</a> is a more broad concept
>  method, when invoked, must run these steps:
>  
>  <ol>
> + <li>
> +  <p>If the global object is a {{ServiceWorkerGlobalScope}} object and its associated
> +  <a>service worker</a>'s <a>script resource</a>'s <a>has ever been evaluated flag</a> is set,
> +  <a>throw</a> an {{InvalidStateError}} exception. [[!SW]]
> +
> +  <p class="note no-backref">To optimize the service worker execution behavior, the user agent
> +  throws an {{InvalidStateError}} exception when the method is called after the very first
> +  evaluation of the service worker script.

The optimization is storing the listeners. The main reason we are doing this is to make it clear you need to add them at a certain time for them to be meaningful.

---
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/dom/pull/155/files#r51706239

Received on Wednesday, 3 February 2016 10:56:52 UTC