Skip to content

var module = module || {}; -> module = {};#830

Merged
dmjio merged 3 commits into
masterfrom
window-top-level
Mar 24, 2025
Merged

var module = module || {}; -> module = {};#830
dmjio merged 3 commits into
masterfrom
window-top-level

Conversation

@dmjio
Copy link
Copy Markdown
Owner

@dmjio dmjio commented Mar 24, 2025

By removing var we keep module named "module" top-level and exported globally. It no longer gets GC'd in the WASM context. Also allows us to truly drop window usage from miso.js, and not use it in the FFI calls.

dmjio added 2 commits March 24, 2025 13:56
By removing `var` we keep `module` named "module" top-level, and it
does not get GC'd in the WASM context. Also allows us to truly drop
window from miso.js, and not use it in the FFI calls.
@dmjio dmjio force-pushed the window-top-level branch from 254f5d5 to 35df863 Compare March 24, 2025 19:23
@dmjio
Copy link
Copy Markdown
Owner Author

dmjio commented Mar 24, 2025

module = typeof module === 'undefined' ? {} : module; <- this does the trick to allow the test runner (which uses node.js) to work harmoniously with the JS backend and WASM / jsaddle workflows.

If we just do

module = {}

this will overwrite the environment necessary for the node.js test runner to execute our tests.

@dmjio dmjio merged commit 78b4983 into master Mar 24, 2025
@dmjio dmjio deleted the window-top-level branch March 24, 2025 20:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant