Skip to content
Merged
Changes from 4 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
8 changes: 6 additions & 2 deletions src/mono/wasm/runtime/library_mono.js
Original file line number Diff line number Diff line change
Expand Up @@ -2365,12 +2365,14 @@ var MonoSupportLib = {
},

/**
* Loads the mono config file (typically called mono-config.json)
* Loads the mono config file (typically called mono-config.json) asynchroniously
* Note: the run dependencies are so emsdk actually awaits it in order.
*
* @param {string} configFilePath - relative path to the config file
* @throws Will throw an error if the config file loading fails
*/
mono_wasm_load_config: async function (configFilePath) {
mono_wasm_load_config: async function (configFilePath) {
Module.addRunDependency('mono-config.json');
try {
let config = null;
// NOTE: when we add nodejs make sure to include the nodejs fetch package
Expand All @@ -2382,8 +2384,10 @@ var MonoSupportLib = {
} else { // shell or worker
config = JSON.parse(read(configFilePath)); // read is a v8 debugger command
}
Module.removeDependency('mono-config.json');
return config;
} catch(e) {
Module.removeDependency('mono-config.json');
return {message: "failed to load config file", error: e};
}
}
Expand Down