Service Worker
Usage
Basic Update Button
<div {{ stimulus_controller('@pwa/service-worker') }}>
<button
id="update-btn"
{{ stimulus_action('@pwa/service-worker', 'update', 'click') }}
style="display:none;"
>
Update Available - Click to Refresh
</button>
</div>
<script>
document.addEventListener('pwa--service-worker:update-available', () => {
document.getElementById('update-btn').style.display = 'block';
});
</script>Update Notification Banner
Toast Notification with Countdown
Integration with User Settings
Parameters
Actions
update
updateTargets
Events
pwa--service-worker:update-available
pwa--service-worker:update-availableBest Practices
Configuration Reference
Advanced Example: Update Manager
Last updated
Was this helpful?