imacrayon / alpine-ajax

An Alpine.js plugin for building server-powered frontends.
https://alpine-ajax.js.org
MIT License
666 stars 15 forks source link

Polling support? #69

Closed fatherofinvention closed 7 months ago

fatherofinvention commented 7 months ago

Hello. Alpine-Ajax is awesome, so thank you! I'm wondering if polling is possible, like in HTMX: https://htmx.org/docs/#polling

imacrayon commented 7 months ago

There’s not a fancy API for it, but throw a $ajax() call inside a setTimeout or setInterval and you’ve got polling. This example does some polling to update a progress indicator: https://alpine-ajax.js.org/examples/progress-bar/

fatherofinvention commented 7 months ago

Cool thanks @imacrayon !