Alpine: x-on debounce?

Created on 28 Jan 2020  路  6Comments  路  Source: alpinejs/alpine

For starters, thank you so much for this Caleb. I freaking love alpine.

Just a quick question though. Is there no debounce on input methods like there is in Livewire.
I've tried:
x-on:input.debounce="function()"
x-on:input.debounce.500="function()"

And both always execute the function immediately.

I know I can just use setTimeout in the function. Just wanted to see if it was already built in and i'm just doing it wrong.

Thanks again for the awesome framework!!!

enhancement

All 6 comments

Yeah, I would be down for adding this to the framework. If someone could PR this that would be great.

That鈥檚 awesome Caleb. Thank you.

You鈥檙e making the dev world such a better place to work and live in.

@calebporzio @awcodes I added a PR and you can see it running here https://codepen.io/jreviews/pen/oNgPgXG

Dang, it! I wanted to make the PR :laughing:

You guys rock. Wish I was better at JS so I could have PR'd it. :)

Works as I expected.

Thanks everybody.

Going to close this issue since the PR got merged. Thanks for contributing guys! Just a little note, if you mention the issue number inside of the PR description using 'Fixes #[issue]', or 'Closes #[issue]' it will automatically close issue once merged. Thanks again!

Was this page helpful?
0 / 5 - 0 ratings