-
Notifications
You must be signed in to change notification settings - Fork 115
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
Simplified API for background/asynchronous code #2174
Comments
Fedoseew
changed the title
Simplified api for background/asynchronous code
Simplified API for background/asynchronous code
Aug 28, 2023
Vaadin has a Debouncer for JS code that is used to collapse multiple callbacks into one invocation after a timer. For example:
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Main goal
To simplify the work with
asynchronous/background
calls.Description
At the moment we have a BackgroundTask mechanism. This mechanism is in some cases too redundant and looks too complicated.
For example, if we need to load some data and then process the result (on UI thread), then we will have to write a lot of code to achieve the desired result and so on every time, for every such call. This may scare off novice developers a little and annoy others.
Suggestion
It would be convenient to use something like
AsyncUtil.executeInBackground(currentView, dataFetchingSupplier, resultHandlerConsumer)
.You can also see an example of this approach in the Async Manager addon .
I attach an approximate implementation (UiUtils.txt) that was used on one of the projects, together with the above addon (may be it will be useful).
The text was updated successfully, but these errors were encountered: