-
How can I run a js backend from another note in an action of a toolbar button? I can't find any runNote function or something similar in the API. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Hi @saitatter! I'm Dosu and I’m helping the Trilium team. There isn’t a direct For code reuse, Trilium supports organizing scripts as child notes (CommonJS modules). Child notes are automatically imported and their exported functions can be called from the parent note’s script discussion. If you need to trigger backend code in another note, you can set up a custom REST endpoint using a backend JS note labeled with In summary: there’s no built-in way to run another note’s script directly, but you can modularize code as child notes or use custom request handlers for more advanced triggers. To reply, just mention @dosu. How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other |
Beta Was this translation helpful? Give feedback.
Hi @saitatter! I'm Dosu and I’m helping the Trilium team.
There isn’t a direct
runNote
API or function to execute a note’s script from another note in Trilium. Toolbar buttons can trigger backend JavaScript usingapi.runOnBackend
, but this runs code you define in the button’s note, not in another note’s script Task Manager example.For code reuse, Trilium supports organizing scripts as child notes (CommonJS modules). Child notes are automatically imported and their exported functions can be called from the parent note’s script discussion.
If you need to trigger backend code in another note, you can set up a custom REST endpoint using a backend JS note labeled with
#customRequestHandler
. …