For the complete documentation index, see llms.txt. This page is also available as Markdown.
Code Runner Widget
Widgets in Workshop
Code Runner Widget
Currently we only provide JavaScript code runner. The supported syntax remains consistent with Expression, including ECMAScript 5.1 and certain 6+ features.
We don't support third-party libraries or host-environment-specific API like fetch.
Config
Fields besides widget_id and output_name
Field's Name
JSON Type (Required/Optional)
Description
Example
code
string (Required)
A stringified code snippet. It should contain one or more function definitions.
"function main(params) {\n const { a, b } = params;\n const sum = a + b;\n return sum;\n}"
function
string (Optional)
The name of the function you want to call in the code snippet. Defaults to main.
'main'
params
Object (Optional)
The parameters you pass to the calling function.
‘Hello.’
You can use the widget's 'Copy' button to get a stringified code snippet for code field.