mirror of https://github.com/pyodide/pyodide.git
Remove dataLoadPromise in pyodide.js (#1075)
This is not necessary, because postRun is not run until all dependencies are satisfied. Since the definition of Module.postRun is slightly modified here, I took the opportunity to convert it to use async/await.
This commit is contained in:
parent
e11d40ef04
commit
3e33d88373
|
@ -362,31 +362,15 @@ var languagePluginLoader = new Promise((resolve, reject) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
Module.locateFile = (path) => baseURL + path;
|
Module.locateFile = (path) => baseURL + path;
|
||||||
var postRunPromise = new Promise((resolve, reject) => {
|
Module.postRun = async () => {
|
||||||
Module.postRun = () => {
|
delete self.Module;
|
||||||
delete self.Module;
|
let response = await fetch(`${baseURL}packages.json`);
|
||||||
fetch(`${baseURL}packages.json`)
|
let json = await response.json();
|
||||||
.then((response) => response.json())
|
fixRecursionLimit(self.pyodide);
|
||||||
.then((json) => {
|
self.pyodide = makePublicAPI(self.pyodide, PUBLIC_API);
|
||||||
fixRecursionLimit(self.pyodide);
|
self.pyodide._module.packages = json;
|
||||||
self.pyodide = makePublicAPI(self.pyodide, PUBLIC_API);
|
resolve();
|
||||||
self.pyodide._module.packages = json;
|
};
|
||||||
resolve();
|
|
||||||
});
|
|
||||||
};
|
|
||||||
});
|
|
||||||
|
|
||||||
var dataLoadPromise = new Promise((resolve, reject) => {
|
|
||||||
Module.monitorRunDependencies =
|
|
||||||
(n) => {
|
|
||||||
if (n === 0) {
|
|
||||||
delete Module.monitorRunDependencies;
|
|
||||||
resolve();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
Promise.all([ postRunPromise, dataLoadPromise ]).then(() => resolve());
|
|
||||||
|
|
||||||
const scriptSrc = `${baseURL}pyodide.asm.js`;
|
const scriptSrc = `${baseURL}pyodide.asm.js`;
|
||||||
loadScript(scriptSrc, () => {
|
loadScript(scriptSrc, () => {
|
||||||
|
|
Loading…
Reference in New Issue