-
-
Notifications
You must be signed in to change notification settings - Fork 292
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
@bind for Observables #2895
Comments
Having Observables.jl integration in Pluto would be very nice, I think. |
Hey @aplavin ! Could you give this a try with Prototype: # ╔═╡ b0d2f6ee-53d9-11ef-1488-89e1652a0a68
using Observables
# ╔═╡ 5826d8f7-9aeb-438d-b426-ac166ab9800c
using PlutoHooks
# ╔═╡ dcc6a1e5-29ea-4f57-9bc6-cbaa923c0e2c
obs = Observable(0)
# ╔═╡ d2796325-fae8-4080-9178-35e115ee7cd7
zzz = let
state, set_state = @use_state(obs[])
Observables.on(set_state, obs)
@use_effect([]) do
return () -> Observables.off(set_state)
end
state
end
# ╔═╡ b7b29cef-bee6-4258-b411-968c0f1f9667
rand(zzz)
# ╔═╡ 5e6e0ef9-7387-469b-97a7-5d552e0f2eab
obs[] = 3 Schermopname.2024-08-06.om.12.03.50.mov |
If I am not mistaken, is this also a related and still open issue? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Observables.jl is a widely used package defining, well
Observable()
. It would be useful to bind Pluto UI elements to Observables, so that supporting libraries (such as Makie) update values efficiently.I tried to make a macro
@bindobs
that works similar to@bind
but defines an observable. I didn't manage to implement it properly, so would be happy to know if I missed something, or is such a thing not supported yet.What I achieved is a "two-part" macro:
then, in one cell do
@bindobs myval Slider(...)
and in another cell@bindobs_ myval
.Can this be done in a single cell?
The text was updated successfully, but these errors were encountered: