From b79b7eefcd520b40dcab220c65fdf5987fb8329f Mon Sep 17 00:00:00 2001 From: Fons van der Plas Date: Mon, 12 Aug 2024 15:49:04 +0200 Subject: [PATCH] test --- sample/test_bind_dynamics.jl | 91 ++++++++++++++++++++++++++++++++++++ 1 file changed, 91 insertions(+) create mode 100644 sample/test_bind_dynamics.jl diff --git a/sample/test_bind_dynamics.jl b/sample/test_bind_dynamics.jl new file mode 100644 index 0000000000..7096c475db --- /dev/null +++ b/sample/test_bind_dynamics.jl @@ -0,0 +1,91 @@ +### A Pluto.jl notebook ### +# v0.19.45 + +using Markdown +using InteractiveUtils + +# This Pluto notebook uses @bind for interactivity. When running this notebook outside of Pluto, the following 'mock version' of @bind gives bound variables a default value (instead of an error). +macro bind(def, element) + quote + local iv = try Base.loaded_modules[Base.PkgId(Base.UUID("6e696c72-6542-2067-7265-42206c756150"), "AbstractPlutoDingetjes")].Bonds.initial_value catch; b -> missing; end + local el = $(esc(element)) + global $(esc(def)) = Core.applicable(Base.get, el) ? Base.get(el) : iv(el) + el + end +end + +# ╔═╡ a0fe4e4d-eee5-4420-bd58-3f12749a9ed1 +@bind reset_xs html"" + +# ╔═╡ 58db6bd4-58a6-11ef-3795-fd6e57eceb68 +@bind x html"""
+ + +
""" + +# ╔═╡ 8568c646-0233-4a95-8332-2351e9c56027 +@bind withsleep html"" + +# ╔═╡ 8a20fa4a-ac02-4a37-a54e-e4224628db66 +x + +# ╔═╡ 29f1d840-574e-463c-87d3-4b938e123493 +begin + reset_xs + xs = [] +end + +# ╔═╡ 3155b6e0-8e19-4583-b2ab-4ab2db1f10b9 +md""" +Click **reset_xs**. + +Click **Start**. + +The cell below should give: `1,done`. + +Not: `1,2,done` or something like that. That means that an intermediate bond value (`2`) found its way through: [https://github.com/fonsp/Pluto.jl/issues/1891](https://github.com/fonsp/Pluto.jl/issues/1891) +""" + +# ╔═╡ 029e1d1c-bf42-4e2c-a141-1e2eecc0800d +begin + withsleep && sleep(1.5) + push!(xs, x) + xs_done = true + + join(xs[2:end], ",") |> Text +end + +# ╔═╡ Cell order: +# ╟─a0fe4e4d-eee5-4420-bd58-3f12749a9ed1 +# ╟─58db6bd4-58a6-11ef-3795-fd6e57eceb68 +# ╟─8568c646-0233-4a95-8332-2351e9c56027 +# ╠═8a20fa4a-ac02-4a37-a54e-e4224628db66 +# ╠═29f1d840-574e-463c-87d3-4b938e123493 +# ╟─3155b6e0-8e19-4583-b2ab-4ab2db1f10b9 +# ╠═029e1d1c-bf42-4e2c-a141-1e2eecc0800d