Skip to content

eval-in-obsidian

Evaluates a function inside a running Obsidian instance via a pluggable transport.

Interface Description
ClickElementParams Parameters for Lib.clickElement.
ClickMouseParams Parameters for Lib.clickMouse.
CommonArguments Common arguments automatically provided to every evalInObsidian callback.
CreateNoteParams Parameters for Lib.createNote.
EvalInObsidianParams Parameters for evalInObsidian.
HoverElementParams Parameters for Lib.hoverElement.
Lib The shared library bag injected into every evalInObsidian callback as CommonArguments.lib. Two layers compose into this one bag. The base — the harness-provided renderer-driving helpers declared below (the trusted-input primitives and Lib.waitUntil) — is always present. On top, provider packages register a renderer-side resolver via registerLibResolver to Object.assign their whole renderer-safe library at runtime, and augment this augmentable interface (the i18next CustomTypeOptions idiom) via declare module 'obsidian-integration-testing' to type it. Multiple providers compose: their exports merge at runtime and their augmentations merge in the type system (interface Lib extends …).
MoveMouseParams Parameters for Lib.moveMouse.
OpenSettingsTabParams Parameters for Lib.openSettingsTab.
PressKeyParams Parameters for Lib.pressKey.
TypeIntoEditorParams Parameters for Lib.typeIntoEditor.
UnhoverElementParams Parameters for Lib.unhoverElement.
WaitUntilParams Parameters for Lib.waitUntil.
Function Description
evalInObsidian Evaluates a function inside the running Obsidian instance via the active transport and returns the parsed result. The function receives an input object that includes app, obsidianModule, context, and any additional input passed by the caller. It is serialized via toString() and invoked as an IIFE. The function must be self-contained — closures over local variables will not work. Pass any needed values as input — they are JSON-serialized and deserialized on the Obsidian side. The result is JSON.stringify’d on the Obsidian side and parsed back.
Type Description
GenericObject A plain object with string keys.
MouseButton The mouse button a trusted click presses, in Electron’s sendInputEvent spelling.