The below graphic shows a summary of the available service worker events:Ĭonsole. So documents will have to be reloaded to actually be controlled. a document starts life with or without a Service worker and maintains that for its lifetime. The primary use of onactivate is for cleanup of resources used in previous versions of a Service worker script. When the service worker is installed, it then receives an activate event.
This is really the same kind of procedure as installing a native or Firefox OS app - making everything available for use offline. An Install event is always the first one sent to a service worker (this can be used to start the process of populating an IndexedDB, and caching site assets).
With service workers, the following steps are generally observed for basic set up: