Skip to content
New issue

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

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

Already on GitHub? # to your account

Connect the btn's loading indicator #2

Open
yakir12 opened this issue Jan 18, 2024 · 1 comment
Open

Connect the btn's loading indicator #2

yakir12 opened this issue Jan 18, 2024 · 1 comment

Comments

@yakir12
Copy link

yakir12 commented Jan 18, 2024

I find the loading indicator of the btn really useful feedback. It tells the client that the download is progressing, which is important when the size of the downloaded asset is large.

In the following MWE I attempted to connect the download event to the loading state of the btn, but this naive approach did not work:

using Stipple, Stipple.ReactiveTools
using StippleUI
using StippleDownloads

const asset = rand(UInt8, 10^7) # 10 MB

@app @event download_event download_binary(__model__, asset, "name"; client = event["_client"])

ui() = btn("Download", @on(:click, :download_event, :addclient), loading=:download_event)

@page("/", ui)

up()

What would be the idiomatic way to achieve this?

@essenciary
Copy link
Member

It's a nice idea - would be cool to have this as a default into the component.

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

No branches or pull requests

2 participants