Skip to content

ContextId<_Context>

A typed context identifier for persisting non-serializable values across evalInObsidian calls.

The context is a persistent object stored on window in the Obsidian process. All calls sharing the same ContextId share the same context object, allowing non-serializable values (e.g. TFile, Editor) to survive across calls.

Implements AsyncDisposable for use with await using.

Import:

import { ContextId } from 'obsidian-integration-testing';

Signature:

export class ContextId<_Context> implements AsyncDisposable

Implements: AsyncDisposable

Constructor

new ContextId()

Creates a new context id.

Methods

MethodReturnsDescription
[Symbol.asyncDispose]()Promise<void>Disposes this context id.
dispose(vaultPath?)Promise<void>Removes this context from the Obsidian process.
toJSON()stringReturns the JSON representation of the context id.
toString()stringReturns the string representation of the context id.

Links to this page: