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 11 commits into
base: main
Choose a base branch
from
Open

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 11 commits June 3, 2023 17:16
This commit adds the auto-Append feature to van.js.

Objects created between begin( ID) and end() are appended as a child to element(ID). ID can be either an element ID or a dom-reference. 

let b = div()
begin(d)
   h1("headline")
   p("This is text")
end()

You can start building a document using begin(document.body)
...
end()

begin() returns a DOM-referencs, so you can also write
van.add(document.body, begin(div()))
    .....
end;

end can have an index end(3) to have repeated calls of end
Add DML-functions to VanJS as an add-on. Just load van_dml.js as a script after VanJS.js to extend functionallity
Description for van_dml.js
Extended Readme for vanDML
Typos fixed
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.

None yet

2 participants