Skip to content

Commit

Permalink
adapt to new JSServe version (#2633)
Browse files Browse the repository at this point in the history
* adapt to new JSServe version

* fix race condition
  • Loading branch information
SimonDanisch authored Jan 27, 2023
1 parent 19a4401 commit 07c5f61
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion WGLMakie/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ FreeTypeAbstraction = "0.10"
GeometryBasics = "0.4.1"
Hyperscript = "0.0.3, 0.0.4"
ImageMagick = "1.1"
JSServe = "2.0.1"
JSServe = "2.1"
Makie = "=0.19.1"
Observables = "0.5.1"
RelocatableFolders = "0.1, 0.2, 0.3, 1.0"
Expand Down
6 changes: 3 additions & 3 deletions WGLMakie/src/three_plot.jl
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ function all_plots_scenes(scene::Scene; scene_uuids=String[], plot_uuids=String[
return scene_uuids, plot_uuids
end

function JSServe.print_js_code(io::IO, plot::AbstractPlot, context::IdDict)
function JSServe.print_js_code(io::IO, plot::AbstractPlot, context::JSServe.JSSourceContext)
uuids = js_uuid.(Makie.flatten_plots(plot))
# This is a bit more complicated then it has to be, since evaljs / on_document_load
# isn't guaranteed to run after plot initialization in an App... So, if we don't find any plots,
Expand All @@ -34,7 +34,7 @@ function JSServe.print_js_code(io::IO, plot::AbstractPlot, context::IdDict)
}))""", context)
end

function JSServe.print_js_code(io::IO, scene::Scene, context::IdDict)
function JSServe.print_js_code(io::IO, scene::Scene, context::JSServe.JSSourceContext)
JSServe.print_js_code(io, js"""$(WGL).then(WGL=> WGL.find_scene($(js_uuid(scene))))""", context)
end

Expand All @@ -58,8 +58,8 @@ function three_display(session::Session, scene::Scene; screen_config...)
// well.... not nice, but can't deal with the `Promise` in all the other functions
window.WGLMakie = WGL
WGL.create_scene($wrapper, canvas, $canvas_width, $scene_serialized, $comm, $width, $height, $(config.framerate), $(ta))
$(done_init).notify(true)
})
$(done_init).notify(true)
}
"""

Expand Down

0 comments on commit 07c5f61

Please sign in to comment.