- From: Jungkee Song <notifications@github.com>
- Date: Mon, 06 Jul 2015 05:00:45 -0700
- To: slightlyoff/ServiceWorker <ServiceWorker@noreply.github.com>
- Message-ID: <slightlyoff/ServiceWorker/issues/718/118833261@github.com>
Currently we settled on https://github.com/slightlyoff/ServiceWorker/issues/225#issue-31115283 but people didn't want to override `addEventListener` to record the registered event types. I'd like to try to add _the list of event types to handle_ on the service worker's environment settings object created in step 5 of [Run Service Worker](https://slightlyoff.github.io/ServiceWorker/spec/service_worker/#run-service-worker-algorithm) algorithm. And set its value after step 14 like the following: ``` 14. Jump to the script's code entry-point, and let that run until it either returns... 15. Set settingsObject's _list of event types to handle_ to the set of event types retrieved from the _associated list of event listeners_ of settingsObject's global object. 16. Run the responsible event loop specified by settingsObject until it is destroyed. ``` As step 15 runs before the event loop starts running, the _list of event types to handle_ will retain only the event types that have been added during the first script eval. And in step 14 of [Handle Fetch](https://slightlyoff.github.io/ServiceWorker/spec/service_worker/#on-fetch-request-algorithm) algorithm, we can do: If registration's active worker's environment settings object's _list of event types to handle_ doesn't contain `fetch`, return null (i.e, fall back to network). --- Reply to this email directly or view it on GitHub: https://github.com/slightlyoff/ServiceWorker/issues/718#issuecomment-118833261
Received on Monday, 6 July 2015 12:01:33 UTC