BackgroundSync Queue
pwa:
serviceworker:
enabled: true
workbox:
enabled: true
background_sync:
- queue_name: 'form'
#... other parameter here
broadcast_channel: 'form-list'<script type="module">
const target = document.getElementById('remaining-items');
const update = (e) => {
if (Number.isInteger(e.detail.remaining)) {
target.innerText = e.detail.remaining;
}
};
document.addEventListener('pwa--backgroundsync-queue:status', (e) => update(e));
</script>
Number of requests in the queue: <span id="remaining-items">--</span>.
<button
{{ stimulus_controller('@pwa/backgroundsync-queue', {channel: "form-list"}) }}
{{ stimulus_action('@pwa/backgroundsync-queue', 'replay')}}>
Replay!
</button>Parameters
Actions
Targets
Events
Last updated
Was this helpful?