11# ## A Pluto.jl notebook ###
2- # v0.19.12
2+ # v0.19.27
33
44using Markdown
55using InteractiveUtils
66
7- # 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).
8- macro bind (def, element)
9- quote
10- local iv = try Base. loaded_modules[Base. PkgId (Base. UUID (" 6e696c72-6542-2067-7265-42206c756150" ), " AbstractPlutoDingetjes" )]. Bonds. initial_value catch ; b -> missing ; end
11- local el = $ (esc (element))
12- global $ (esc (def)) = Core. applicable (Base. get, el) ? Base. get (el) : iv (el)
13- el
14- end
15- end
16-
177# ╔═╡ 3689bb1b-23f8-41ae-a392-fb2ee2ec40d7
188# ╠═╡ skip_as_script = true
199#= ╠═╡
2414end
2515 ╠═╡ =#
2616
27- # ╔═╡ e7a070ab-67e7-444b-88d8-87c14aaef046
28- # ╠═╡ skip_as_script = true
29- #= ╠═╡
30- names(@__MODULE__)
31- ╠═╡ =#
32-
3317# ╔═╡ fed9022f-1e8e-4f47-92d8-f99065023d29
3418import AbstractPlutoDingetjes. Bonds
3519
@@ -47,14 +31,15 @@ begin
4731 fixed:: Bool = false
4832 start_running:: Bool = false
4933 max_value:: Union{Int64,Nothing} = nothing
34+ repeat:: Bool = false
5035
5136 # Clock(interval, fixed, start_running, max_value) = interval >= 0 ? new(interval, fixed, start_running, max_value) : error("interval must be non-negative")
5237 end
5338
5439 # for backwards compat
55- Clock (interval; kwargs... ) = Clock (interval= interval; kwargs... )
40+ Clock (interval; kwargs... ) = Clock (; interval= interval, kwargs... )
5641
57- Clock (interval, fixed, start_running= false ) = Clock (interval, fixed, start_running, nothing )
42+ Clock (interval, fixed, start_running= false , max_value = nothing ) = Clock (; interval= interval , fixed= fixed , start_running= start_running, max_value = max_value )
5843
5944 # We split the HTML string into multiple files, but you could also write all of this into a single (long) string 🎈
6045 const cb = read (joinpath (@__DIR__ , " .." , " assets" , " clock_back.svg" ), String)
6752 clock. interval < 0 && error (" interval must be non-negative" )
6853
6954 result = """
70- <plutoui-clock class='$(clock. fixed ? " fixed" : " " )$(clock. start_running ? " " : " stopped" ) ' data-max-value=$(repr (clock. max_value)) >
55+ <plutoui-clock class='$(clock. fixed ? " fixed" : " " )$(clock. start_running ? " " : " stopped" ) ' data-max-value=$(repr (clock. max_value)) data-repeat= $( repr (clock . repeat)) >
7156 <plutoui-analog>
7257 <plutoui-back>$(cb) </plutoui-back>
7358 <plutoui-front>$(cf) </plutoui-front>
10590@bind tick Clock()
10691 ╠═╡ =#
10792
93+ # ╔═╡ 4930b73b-14e1-4b1d-8efe-686e31d69070
94+ #= ╠═╡
95+ tick
96+ ╠═╡ =#
97+
10898# ╔═╡ 9ecd95f0-d7a5-4ee9-9e18-9d87e5d43ab7
10999#= ╠═╡
110100tick; rand()
@@ -126,6 +116,18 @@ tick
126116fasttick
127117 ╠═╡ =#
128118
119+ # ╔═╡ b45005b3-822b-4b72-88ef-3f9fe865de6a
120+ # ╠═╡ skip_as_script = true
121+ #= ╠═╡
122+ @bind loopy Clock(0.5, max_value=4, repeat=true)
123+ ╠═╡ =#
124+
125+ # ╔═╡ e7a070ab-67e7-444b-88d8-87c14aaef046
126+ # ╠═╡ skip_as_script = true
127+ #= ╠═╡
128+ loopy
129+ ╠═╡ =#
130+
129131# ╔═╡ a5f8ed96-136c-4ff4-8275-bd569f0dae40
130132md """
131133## Different constructors
@@ -155,6 +157,12 @@ Clock(3.0, true, true)
155157Clock(3.0, true, true, 5)
156158 ╠═╡ =#
157159
160+ # ╔═╡ f9f1e6db-d4a6-40dc-908e-51ed5833011c
161+ # ╠═╡ skip_as_script = true
162+ #= ╠═╡
163+ Clock(3.0, true, true, 5, true)
164+ ╠═╡ =#
165+
158166# ╔═╡ 9115fbcd-1550-4439-a830-c69b83b774b3
159167# ╠═╡ skip_as_script = true
160168#= ╠═╡
194202
195203# ╔═╡ Cell order:
196204# ╠═06289ad2-9e2f-45b3-9d15-7c5a4167e138
205+ # ╠═4930b73b-14e1-4b1d-8efe-686e31d69070
197206# ╠═9ecd95f0-d7a5-4ee9-9e18-9d87e5d43ab7
198207# ╠═d82dae11-b2c6-42b5-8c52-67fbb6cc236a
199208# ╠═80c6e80e-077a-4e31-9467-788a8c437bfc
200209# ╠═63854404-e6a5-4dc6-a40e-b09b9f531465
210+ # ╠═b45005b3-822b-4b72-88ef-3f9fe865de6a
201211# ╠═e7a070ab-67e7-444b-88d8-87c14aaef046
202212# ╠═3689bb1b-23f8-41ae-a392-fb2ee2ec40d7
203213# ╠═fed9022f-1e8e-4f47-92d8-f99065023d29
208218# ╠═83a021ab-7cca-47c7-a560-9cbf58b35ab7
209219# ╠═c96dfd13-ddd4-443f-ab09-30e15ea76785
210220# ╠═78ee5465-ce3b-45f6-acec-aa69175807f5
221+ # ╠═f9f1e6db-d4a6-40dc-908e-51ed5833011c
211222# ╠═9115fbcd-1550-4439-a830-c69b83b774b3
212223# ╠═f4104cb3-7c07-4814-99f9-a00764ebadf6
213224# ╠═21cba3fb-7bb0-43ae-b4c4-5c1eb7241fec
0 commit comments