# Service Worker

The Service Worker controller provides useful methods to facilitate interaction with the service worker lifecycle. Currently, it offers a method to manually update the service worker when the [`skipWaiting`](/1.3.x/the-service-worker/configuration.md#skip-waiting) option is set to `false`.

**Usage**

```twig
<div {{ stimulus_controller('@pwa/service-worker')>
    <button {{ stimulus_action('@pwa/service-worker', 'update') }}>
        Update
    </button>
</div>
```

### Parameters

None

### Actions

`update`: tries to update the service worker. Will refresh the page when done.

### Targets

None

### Events

`pwa--service-worker:update-available`: indicates an update is available. Can be used to update the UI and show the update button.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://pwa.spomky-labs.com/1.3.x/symfony-ux/service-worker.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
