mirror of https://github.com/pyodide/pyodide.git
LINT
This commit is contained in:
parent
8d37d095b3
commit
c2e981b87e
|
@ -32,11 +32,12 @@ var languagePluginLoader = new Promise((resolve, reject) => {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// clang-format off
|
||||||
let preloadWasm = () => {
|
let preloadWasm = () => {
|
||||||
// On Chrome, we have to instantiate wasm asynchronously. Since that can't
|
// On Chrome, we have to instantiate wasm asynchronously. Since that
|
||||||
// be done synchronously within the call to dlopen, we instantiate every .so
|
// can't be done synchronously within the call to dlopen, we instantiate
|
||||||
// that comes our way up front, caching it in the `preloadedWasm`
|
// every .so that comes our way up front, caching it in the
|
||||||
// dictionary.
|
// `preloadedWasm` dictionary.
|
||||||
|
|
||||||
let promise = new Promise((resolve) => resolve());
|
let promise = new Promise((resolve) => resolve());
|
||||||
let FS = pyodide._module.FS;
|
let FS = pyodide._module.FS;
|
||||||
|
@ -55,11 +56,12 @@ var languagePluginLoader = new Promise((resolve, reject) => {
|
||||||
const path = rootpath + entry;
|
const path = rootpath + entry;
|
||||||
if (entry.endsWith('.so')) {
|
if (entry.endsWith('.so')) {
|
||||||
if (Module['preloadedWasm'][path] === undefined) {
|
if (Module['preloadedWasm'][path] === undefined) {
|
||||||
promise = promise.then(
|
promise = promise
|
||||||
() => Module['loadWebAssemblyModule'](FS.readFile(path), true)
|
.then(() => Module['loadWebAssemblyModule'](
|
||||||
).then(
|
FS.readFile(path), true))
|
||||||
(module) => { Module['preloadedWasm'][path] = module; }
|
.then((module) => {
|
||||||
);
|
Module['preloadedWasm'][path] = module;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
} else if (FS.isDir(FS.lookupPath(path).node.mode)) {
|
} else if (FS.isDir(FS.lookupPath(path).node.mode)) {
|
||||||
recurseDir(path + '/');
|
recurseDir(path + '/');
|
||||||
|
@ -71,6 +73,7 @@ var languagePluginLoader = new Promise((resolve, reject) => {
|
||||||
|
|
||||||
return promise;
|
return promise;
|
||||||
}
|
}
|
||||||
|
// clang-format on
|
||||||
|
|
||||||
let _loadPackage = (names) => {
|
let _loadPackage = (names) => {
|
||||||
// DFS to find all dependencies of the requested packages
|
// DFS to find all dependencies of the requested packages
|
||||||
|
@ -132,8 +135,7 @@ var languagePluginLoader = new Promise((resolve, reject) => {
|
||||||
delete window.pyodide._module.monitorRunDependencies;
|
delete window.pyodide._module.monitorRunDependencies;
|
||||||
const packageList = Array.from(Object.keys(toLoad)).join(', ');
|
const packageList = Array.from(Object.keys(toLoad)).join(', ');
|
||||||
if (!isFirefox) {
|
if (!isFirefox) {
|
||||||
preloadWasm().then(() => {
|
preloadWasm().then(() => {resolve(`Loaded ${packageList}`)});
|
||||||
resolve(`Loaded ${packageList}`) });
|
|
||||||
} else {
|
} else {
|
||||||
resolve(`Loaded ${packageList}`);
|
resolve(`Loaded ${packageList}`);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue