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

State change debounce #50

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

efpage
Copy link
Contributor

@efpage efpage commented Jun 6, 2023

Van propagates every state change immediately to the bound DOM elements. This may result in a bad user experience, if too many changes are applied at a high frequency.

VanJs contains everything to limit the state change rate. It just requires to set one variable to use it. I provided this variable and a setter to change it. I provided a possible implementation, if there are other ways this would be ok.

efpage added 5 commits June 7, 2023 00:10
Van still provides the tools to limit the update rate. 

```JS
let {updateRate} = van
updateRate(100) 
```

This set´s the update rate to 100ms. state changes are delayed by up to 100 ms, before they are propagated to the DOM. If multiple changes are applied withi this time, only the last is updating the DOM.
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

Successfully merging this pull request may close these issues.

1 participant