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