brython/manager/loader.js - Brython Loader
Location: src/brython/manager/loader.js
This file is responsible for dynamically loading the Brython runtime into the browser.
Function: loadBrython(options)
- Description: This function injects the
brython.jsandbrython_stdlib.jsscripts into the document's<head>. It ensures that the scripts are loaded only once and then initializes the Brython runtime by callingwindow.brython(). - Parameters:
options(Object): An object that can contain the following properties:brythonJsPath(string): The path to thebrython.jsfile.brythonStdlibPath(string): The path to thebrython_stdlib.jsfile.
- Returns: A
Promisethat resolves when the Brython runtime is loaded and initialized. - Throws:
Errorif the script fails to load.