evalInObsidian<Input, Result, TContextId>
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.
Import:
import { evalInObsidian } from 'obsidian-integration-testing';Signature:
function evalInObsidian(params: EvalInObsidianParams<Input, Result, TContextId>): Promise<Result>Parameters:
| Parameter | Type | Description |
|---|---|---|
params | EvalInObsidianParams<Input, Result, TContextId> | The parameters for the function to evaluate. |
Returns: Promise<Result> — A Promise that resolves to the return value of callback.
Links to this page: