Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Give us an event that returns the value while sliding #3

Closed
Flexxkii opened this issue Feb 18, 2022 · 6 comments
Closed

Give us an event that returns the value while sliding #3

Flexxkii opened this issue Feb 18, 2022 · 6 comments

Comments

@Flexxkii
Copy link

My skillsets aren't good enough to do it myself. I hope you're able to add an event that we can use to return the value while sliding.

I'm trying to make my own label this way.

@digitalml
Copy link

If you look at the source this is pretty easy to do (it's even nicely commented)

Simply place this.emitRange(); inside the bottom of the update() method. You'll need to debounce it though as to not overwhelm the browser with events.

@Flexxkii
Copy link
Author

If you look at the source this is pretty easy to do (it's even nicely commented)

Simply place this.emitRange(); inside the bottom of the update() method. You'll need to debounce it though as to not overwhelm the browser with events.

Does that mean that I can retrieve the data from the event listener?
The event listener doesn't seem to update while sliding. Only when the sliding has stopped.

Thanks for helping me out, I'm still pretty noob with JS.

@digitalml
Copy link

digitalml commented Feb 28, 2022 via email

@Flexxkii
Copy link
Author

Flexxkii commented Mar 2, 2022

yes if you add that code to the update it will fire the event listener. but it will fire so often and fast it will kill your ui. you need to debounce it so it slows down. something like this might help you. https://www.freecodecamp.org/news/javascript-debounce-example/

I don't seem to be able to do this, at least without breaking it.
So, I hope that the dev is able to implement it and hopefully push it for next release.

The reason I want to have this is to retrieve the current min and max and make my own label, so that I can prefix it with a currency symbol. It seems that I've just to forget this for now and come back to it later.

Thank you so much for the debounce tutorial link. I definitely need to learn a lot more, and this certainly helps me!

@maxshuty
Copy link
Owner

maxshuty commented Jan 3, 2023

@Flexxkii I will close this as the label prefixes have been added here. As @digitalml mentioned the issue with firing this off so frequently is that it could potentially really hurt the performance of your UI. :)

@maxshuty maxshuty closed this as completed Jan 3, 2023
@dapicester
Copy link

Hi, even if this issue has been closed, I believe the original request has not been addressed.

I have created a PR that adds an optional attribute to emit the event while sliding, see #29.
I did try with a debounce, but I found out it was not giving the wanted result, and because it seems that the UI is not slowed down.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants