Can the data for a download button be "computed when needed", i.e., only once the user clicks the button? Currently I have
mo.download(
data=expensive_function_generating_the_data(),
)
which means
expensive_function_generating_the_data
is called already when the button is created. Instead, I'd prefer something like
mo.download(
data=expensive_function_generating_the_data,
)
where the function would only generate / provide the data when the button is actually clicked, as not the output
expensive_function_generating_the_data()
is passed to the data keyword, but the function handle
expensive_function_generating_the_data
.
I know that this currently does not match the signature of
mo.download
, but is there a way to work around this?