-
Notifications
You must be signed in to change notification settings - Fork 4.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WASM] Converted mono-config.js to mono-config.json #53606
Conversation
Tagging subscribers to this area: @CoffeeFlux Issue DetailsWORK IN PROGRESSThis PR renames the mono-config.js file to mono-config.json, updates the contents accordingly and moves it's loading from the DOM to JS. Why is this needed? What's changed
How it works config: null,
onConfigLoaded: function (config) {
if (!config || config.error){
console.log("An error occured while loading the config file");
return;
}
Module.config = config;
}, Also, note that I am very new to this project (I am an intern) so please let me know if there is anything else that should be improved including coding style, better techniques for loading the files and/or anything else.
|
Tagging subscribers to 'arch-wasm': @lewing Issue DetailsThis PR renames the mono-config.js file to mono-config.json, updates the contents accordingly and moves it's loading from the DOM to JS. Why is this needed? What's changed
How it works config: null,
onConfigLoaded: function (config) {
if (!config || config.error){
console.log("An error occured while loading the config file");
return;
}
Module.config = config;
}, Also, note that I am very new to this project (I am an intern) so please let me know if there is anything else that should be improved including coding style, better techniques for loading the files and/or anything else.
|
As an update, turns out that that |
Make sure it isn't used by blazor |
@kg that shouldn't be an issue because this is a file that I added in a previous commit for this PR :) |
Ah, confused it with dotnet_support :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few small nits but looking good!
This PR renames the mono-config.js file to mono-config.json, updates the contents accordingly and moves it's loading from the DOM to JS.
Why is this needed?
This change is step 0 before adding NodeJS support to the wasm runtime. As NodeJS doesn't have a DOM, we need to load the config file from JS. Moreover, by moving the variable declaration out of the file, we can reduce ambiguity as to what the
config
variable is. This will also have the added benefit of being able to rename the variable if needed.What's changed
MONO.mono_wasm_load_config(configFilePath)
which loads the config file via promises.How it works
The user adds the snippet listed below to their
Module
object. Then emsdk will call it after loading the runtime but before the runtime is started. Then, when the user wants to start the runtime, they can pass theModule.config
object to theMONO.mono_load_runtime_and_bcl_args
function. This approach also allows the user to make runtime modifications to the config prior to passing it to the runtime by editing theModule.config
object.Also, note that I am new to this project (I am an intern) so please let me know if there is anything else that should be improved including coding style, better techniques for loading the files and/or anything else.