Boa's boa_runtime crate contains an example runtime and basic runtime features and
functionality for the boa_engine crate for runtime implementors.
Example: Adding Web API's Console Object
- Add boa_runtime as a dependency to your project along with boa_engine.
use ;
use Console;
// Create the context.
let mut context = default;
// Initialize the Console object.
let console = init;
// Register the console as a global property to the context.
context
.register_global_property
.expect;
// JavaScript source for parsing.
let js_code = "console.log('Hello World from a JS code string!')";
// Parse the source code
match context.eval ;