Skip to content

Commit

Permalink
Merge pull request #56 from JuliaPluto/precompile
Browse files Browse the repository at this point in the history
  • Loading branch information
disberd authored Aug 12, 2024
2 parents 4884a4e + c663b95 commit a93b45e
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
2 changes: 2 additions & 0 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ LaTeXStrings = "b964fa9f-0449-5b57-a5c2-d3ea65f4040f"
Markdown = "d6f4376e-aef5-505a-96c1-9c027394607a"
Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
PlotlyBase = "a03496cd-edff-5a9b-9e67-9cda94a718b5"
PrecompileTools = "aea7be01-6a6a-4083-8856-8a6e6704d82a"
Reexport = "189a3867-3050-52da-a836-e630ba90ab69"
ScopedValues = "7e506255-f358-4e82-b7e4-beb19740aa63"
Scratch = "6c6a2e73-6563-6170-7368-637461726353"
Expand All @@ -41,6 +42,7 @@ Markdown = "1.9"
Pkg = "1.9"
PlotlyBase = "0.8"
PlotlyKaleido = "2"
PrecompileTools = "1.2.1"
Reexport = "1"
ScopedValues = "1.2.1"
Scratch = "1"
Expand Down
16 changes: 15 additions & 1 deletion src/PlutoPlotly.jl
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ using Markdown
using Downloads: download
using Artifacts
using ScopedValues
using PrecompileTools
# This is similar to `@reexport` but does not exports undefined names and can
# also avoid exporting the module name
function re_export(m::Module; skip_modname = false)
Expand Down Expand Up @@ -49,10 +50,23 @@ include("show.jl")
# Forward methods of PlotlyBase to support PlutoPlot objects
include("plotlybase_forward.jl")

function __init__()
# function __init__()
# if !is_inside_pluto()
# @warn "You loaded this package outside of Pluto, this is not the intended behavior and you should use either PlotlyBase or PlotlyJS directly.\nNOTE: If you receive this warning during pre-compilation or sysimage creation, you can ignore this warning."
# end
# end

@compile_workload begin
data = [
scatter(;y = rand(10)),
scattergeo(;lat = rand(10), lon = rand(10)),
heatmap(;z = rand(10,10)),
surface(;z = rand(10,10))
]
layout = Layout(;title = "lol")
p = plot(data, layout)
_show(p)
plot(rand(10,4)) |> _show
end

end

0 comments on commit a93b45e

Please sign in to comment.