Skip to content

Run JavaScript File Button Action

The run JavaScript file action runs a JavaScript file.

interface JSButtonAction {
type: 'js';
file: string; // the path to the JavaScript file to run, relative to the vault root
args?: Record<string, unknown>; // optional arguments to pass to the script
}

Example

```meta-bind-button
style: primary
label: Run JavaScript File
action:
type: js
file: someScript.js
```

With the following someScript.js file in the vault root.

someScript.js
console.log('Hello World!');

You should see the string Hello World! printed to the console, when you click the button.