1- using . AssetRegistry
2- using . Sockets
3- using . WebIO
1+ module IJuliaExt
42
5- struct IJuliaConnection <: AbstractConnection
6- comm:: IJulia.CommManager.Comm
7- end
3+ using WebIO
4+ using WebIO: WEBIO_NODE_MIME, _IJuliaInit
5+ using IJulia, Sockets
6+
7+ # struct IJuliaConnection <: AbstractConnection
8+ # comm::IJulia.CommManager.Comm
9+ # end
10+ IJuliaConnection = Connection{IJulia. CommManager. Comm}
811
912function Sockets. send (c:: IJuliaConnection , data)
10- IJulia. send_comm (c . comm , data)
13+ IJulia. send_comm (connection (c) , data)
1114end
1215
13- Base. isopen (c:: IJuliaConnection ) = haskey (IJulia. CommManager. comms, c . comm . id)
16+ Base. isopen (c:: IJuliaConnection ) = haskey (IJulia. CommManager. comms, connection (c) . id)
1417
1518WebIO. register_renderable (T:: Type , :: Val{:ijulia} ) = nothing
1619
@@ -37,7 +40,6 @@ installed for `WEBIO_NODE_MIME` that is preferred over `text/html`. If the HTML
3740content is actually displayed, it means that the WebIO integration is not
3841correctly installed.
3942"""
40- struct _IJuliaInit end
4143
4244function Base. show (io:: IO , m:: WEBIO_NODE_MIME , :: _IJuliaInit )
4345 Base. show (io, m, node (:div ))
@@ -68,16 +70,18 @@ function main()
6870 return
6971 end
7072
71- # https://github.com/JuliaLang/IJulia.jl/pull/755
72- if isdefined (IJulia, :register_jsonmime )
73- IJulia. register_jsonmime (WEBIO_NODE_MIME ())
74- else
75- @warn " IJulia doesn't have register_mime; WebIO may not work as expected. Please upgrade to IJulia v1.13.0 or greater."
76- end
73+ IJulia. register_jsonmime (WEBIO_NODE_MIME ())
7774
7875 # See comment on _IJuliaInit for what this does
7976 display (_IJuliaInit ())
77+
78+ return nothing
8079end
8180
8281WebIO. setup_provider (:: Val{:ijulia} ) = main () # calling setup_provider(Val(:ijulia)) will display the setup javascript
83- WebIO. setup (:ijulia )
82+
83+ function __init__ ()
84+ WebIO. setup (:ijulia )
85+ end
86+
87+ end
0 commit comments