Skip to content

unavailable

function unavailable(reason): Availability;

Says that an action cannot be used here. This is the answer of the can function of a command. The app greys the action out, and the command palette shows the reason.

Parameter Type Description
reason string why, in words that the person reads

Availability

{ available: false, reason }

ctx.commands.register({
id: 'com.example.pomodoro/pause',
title: 'Pause the pomodoro',
args: { type: 'object' },
can: () => (timerIsRunning() ? available() : unavailable('No pomodoro is running')),
propose: (state, args, draft) => draft,
});