imacrayon / alpine-ajax

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

Polling support? #69

Closed fatherofinvention closed 4 months ago

fatherofinvention commented 4 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 4 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 4 months ago

Cool thanks @imacrayon !