Commit 6457899d authored by Romain Casati's avatar Romain Casati
Browse files

Better way of managing hacked modules.

parent f63ea229
...@@ -357,17 +357,11 @@ var Basthon = (function() { ...@@ -357,17 +357,11 @@ var Basthon = (function() {
* Callback function for hacking several modules before import. * Callback function for hacking several modules before import.
*/ */
that.hackPackagesCallback = function (toLoad) { that.hackPackagesCallback = function (toLoad) {
if( toLoad.includes("matplotlib") ) { const hacked = ["matplotlib", "turtle", "sympy",
pyodide.globals.Basthon.hack_matplotlib(); "folium", "pandas"];
} else if ( toLoad.includes("turtle") ) { for( const p of toLoad )
pyodide.globals.Basthon.hack_turtle(); if( hacked.includes(p) )
} else if ( toLoad.includes("sympy") ) { pyodide.globals.Basthon[`hack_${p}`]();
pyodide.globals.Basthon.hack_sympy();
} else if ( toLoad.includes("folium") ) {
pyodide.globals.Basthon.hack_folium();
} else if ( toLoad.includes("pandas") ) {
pyodide.globals.Basthon.hack_pandas();
}
}; };
/** /**
......
Supports Markdown
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