Commit 0809f746 authored by Michael Droettboom's avatar Michael Droettboom

LINT

parent 4124f18d
......@@ -77,7 +77,8 @@ EM_JS(int, runpython_init_js, (), {
var jsimports = Module.hiwire_get_value(idimports);
Module.hiwire_decref(idimports);
var internal = function(resolve, reject) {
var internal = function(resolve, reject)
{
try {
resolve(Module._runPythonInternal(pycode));
} catch (e) {
......@@ -86,19 +87,21 @@ EM_JS(int, runpython_init_js, (), {
};
if (jsimports.length) {
var packageNames = window.pyodide._module.packages.import_name_to_package_name;
var packageNames =
window.pyodide._module.packages.import_name_to_package_name;
var packages = {};
for (var i = 0; i < jsimports.length; ++i) {
var name = jsimports[i];
// clang-format off
if (packageNames[name] !== undefined) {
// clang-format on
packages[packageNames[name]] = undefined;
}
}
if (Object.keys(packages).length) {
var runInternal = function() {
return new Promise(internal);
};
return Module.loadPackage(Object.keys(packages), messageCallback).then(runInternal);
var runInternal = function() { return new Promise(internal); };
return Module.loadPackage(Object.keys(packages), messageCallback)
.then(runInternal);
}
}
return new Promise(internal);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment