Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ version = "0.8.2-DEV"

[deps]
Base64 = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"
ConstructionBase = "187b0558-2788-49d3-abe0-74a17ed4e7c9"
Electron = "a1bb12fb-d4d1-54b4-b10a-ee7951ef7ad3"
TableShowUtils = "5e66a065-1f0a-5976-b372-e0b8c017ca10"
IteratorInterfaceExtensions = "82899510-4779-5014-852e-03e436cf321d"
Expand Down
20 changes: 2 additions & 18 deletions src/ElectronDisplay.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ module ElectronDisplay
export electrondisplay

using Electron, Base64, Markdown
using ConstructionBase: setproperties

import IteratorInterfaceExtensions, TableTraits, TableShowUtils

Expand All @@ -12,29 +13,12 @@ Base.@kwdef mutable struct ElectronDisplayConfig
focus::Bool = true
end

"""
setconfig(config; kwargs...)

Update a copy of `config` based on `kwargs`.
"""
setconfig(
config::ElectronDisplayConfig;
showable = config.showable,
single_window::Bool = config.single_window,
focus::Bool = config.focus,
) =
ElectronDisplayConfig(
showable = showable,
single_window = single_window,
focus = focus,
)

struct ElectronDisplayType <: Base.AbstractDisplay
config::ElectronDisplayConfig
end

ElectronDisplayType() = ElectronDisplayType(CONFIG)
newdisplay(; config...) = ElectronDisplayType(setconfig(CONFIG; config...))
newdisplay(; config...) = ElectronDisplayType(setproperties(CONFIG; config...))

electron_showable(m, x) =
m ∉ ("application/vnd.dataresource+json", "text/html", "text/markdown") &&
Expand Down