Function rustyscript::import

source ·
pub fn import(path: &str) -> Result<ModuleWrapper, Error>
Expand description

Imports a JS module into a new runtime

§Arguments

  • path - Path to the JS module to import

§Returns

A Result containing a handle to the imported module, or an error if something went wrong.

§Example

let mut module = rustyscript::import("js/my_module.js").expect("Something went wrong!");