Skip to content

Commit

Permalink
JS performance patch
Browse files Browse the repository at this point in the history
  • Loading branch information
fonsp committed Sep 30, 2021
1 parent 08922db commit 7180494
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "PlutoUI"
uuid = "7f904dfe-b85e-4ff6-b463-dae2292396a8"
authors = ["Fons van der Plas <[email protected]>"]
version = "0.7.12"
version = "0.7.13"

[deps]
Base64 = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"
Expand Down
8 changes: 6 additions & 2 deletions src/Scrubbable.jl
Original file line number Diff line number Diff line change
Expand Up @@ -241,8 +241,8 @@ begin
end

write(io, """<script id='$(s.id)'>
const d3format = await import("https://cdn.jsdelivr.net/npm/d3-format@2/+esm")
// weird import to make it faster. The `await import` can still delay execution by one frame if it is already loaded...
window.d3format = window.d3format ?? await import("https://cdn.jsdelivr.net/npm/d3-format@2/+esm")
const argmin = xs => xs.indexOf(Math.min(...xs))
const closest_index = (xs, y) => argmin(xs.map(x => Math.abs(x-y)))
Expand Down Expand Up @@ -329,6 +329,9 @@ begin
Scrubbable
end

# ╔═╡ 5c78e637-5733-4b0a-8dab-bf1cd9656d11
HTML(join(repr.([MIME"text/html"()], [Scrubbable(1.0) for _ in 1:100])))

# ╔═╡ b62db8c0-4352-4d0f-83a2-ac170ef3337a
md"""
_If Alice has $(@bind a Scrubbable(20)) apples,
Expand Down Expand Up @@ -421,6 +424,7 @@ export Scrubbable
# ╠═b081aa76-f080-4dd0-bcff-4bcc82a1c50a
# ╠═8bce6b13-9600-49ca-a7ea-ba2f53028f1b
# ╠═d17d259b-8379-46a7-ab54-cd2f697ec713
# ╠═5c78e637-5733-4b0a-8dab-bf1cd9656d11
# ╟─aed5fa58-4fe3-4596-b18d-a76cd98a5a1b
# ╠═9c7ce2da-4ad8-11eb-14cd-cfcc8d2a6bf8
# ╠═1d34fec8-01cb-4bee-8144-d8cc13a87b8b

2 comments on commit 7180494

@fonsp
Copy link
Member Author

@fonsp fonsp commented on 7180494 Sep 30, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator register()

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/45825

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.7.13 -m "<description of version>" 7180494e58b7b6f872322a4843ce56ecfd5954c1
git push origin v0.7.13

Please sign in to comment.