mrdocs::js::Scope::script

Compile and run a script.

Synopsis

Expected<void>
script(std::string_view jsCode);

Description

This function compiles and executes the specified JavaScript code. The script can be used to execute commands or define global variables in the parent context.

ES module import/export is not enabled; scripts must be self‐contained or rely on globals.

It evaluates the ECMAScript source code and converts any internal errors to Error.

Return Value

The mrdocs result type: polyfill::expected defaulting the error to Error.

Parameters

Name

Description

jsCode

The JavaScript code to execute.

Created with MrDocs