Skip to content

Commit c5fa129

Browse files
committed
introduce node fence for jquery in electron context
1 parent c062eb1 commit c5fa129

File tree

4 files changed

+14
-1
lines changed

4 files changed

+14
-1
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
if (typeof module === 'object') {
2+
window.module = module;
3+
module = undefined;
4+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
if (window.module) {
2+
module = window.module;
3+
}

NetworkDynamicsInspector/src/NetworkDynamicsInspector.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ const JQUERY = Asset(joinpath(ASSETS, "jquery.js"))
3636
const SELECT2_CSS = Asset(joinpath(ASSETS, "select2.css"))
3737
const SELECT2_JS = Asset(joinpath(ASSETS, "select2.js"))
3838
const APP_CSS = Asset(joinpath(ASSETS, "app.css"))
39+
# node fence see https://github.com/electron/electron/issues/254
40+
const NODE_FENCE = Asset(joinpath(ASSETS, "node_fence.js"))
41+
const NODE_UNFENCE = Asset(joinpath(ASSETS, "node_unfence.js"))
3942

4043
include("widgets.jl")
4144
include("graphplot.jl")

NetworkDynamicsInspector/src/widgets.jl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -397,10 +397,13 @@ function Bonito.jsrender(session::Session, multiselect::MultiSelect)
397397
id=multiselect.id,
398398
)
399399

400+
# node fence see https://github.com/electron/electron/issues/254
400401
container = DOM.div(
402+
NODE_FENCE,
401403
JQUERY,
402-
SELECT2_CSS,
403404
SELECT2_JS,
405+
NODE_UNFENCE,
406+
SELECT2_CSS,
404407
select
405408
)
406409

0 commit comments

Comments
 (0)