Skip to content

Commit

Permalink
Add "transient" dict to "display_data" messages
Browse files Browse the repository at this point in the history
(Necessary for any future `"update_display_data"` message
implementation)
  • Loading branch information
halleysfifthinc committed Dec 19, 2024
1 parent e3791f9 commit bcf8553
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/display.jl
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ register_jsonmime(x::AbstractVector{<:MIME}) = push!(ijulia_jsonmime_types, Vect
# return a String=>Any dictionary to attach as metadata
# in Jupyter display_data and pyout messages
metadata(x) = Dict()
transient(x) = Dict()

"""
Generate the preferred MIME representation of x.
Expand Down
3 changes: 3 additions & 0 deletions src/inline.jl
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ for mime in ipy_mime
msg_pub(execute_msg, "display_data",
Dict(
"metadata" => metadata(x), # optional
"transient" => transient(x), # optional
"data" => Dict($mime => limitstringmime(MIME($mime), x)))))
end
displayable(d::InlineDisplay, ::MIME{Symbol($mime)}) = true
Expand All @@ -87,6 +88,7 @@ function display(d::InlineDisplay, M::MIME, x)
send_ipython(publish[],
msg_pub(execute_msg, "display_data",
Dict("metadata" => metadata(x), # optional
"transient" => transient(x), # optional
"data" => d)))
end

Expand All @@ -98,6 +100,7 @@ function display(d::InlineDisplay, x)
send_ipython(publish[],
msg_pub(execute_msg, "display_data",
Dict("metadata" => metadata(x), # optional
"transient" => transient(x), # optional
"data" => display_dict(x))))
end

Expand Down

0 comments on commit bcf8553

Please sign in to comment.