Skip to main content

ConditionContext

interface

What a predicate is allowed to look at. Reads only. `state()` here returns a read-only State even for your own declarations, unlike `ctx.state()` in a handler, which hands back a writable owned handle. Reading a value registers it as a dependency, which is how the host knows when to recompute.

interface ConditionContext

Import

import { ConditionContext } from '@modular/sdk';

Members3

condition
(condition: Condition) => boolean

Evaluate another condition, so rules can build on each other.

lastEvent
<K extends ModularEventId>(id: K) => ModularEventMap[K] | null | <TValue>(id: string) => TValue | null

The payload of the last occurrence of an event, or `null` if none yet.

state
<TValue>(declaration: StateDeclaration<TValue>) => State<TValue> | <TName extends 'editor.selection' | 'host.scope' | 'workbench.colorTheme' | 'workbench.layout' | 'workbench.windowState' | 'workspace.focusedEditorGroupTab'>(name: TName) => State<BuiltInStateValue<TName>>

Read your own declared state.

Notes

category
State