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.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
reason |
string |
why, in words that the person reads |
Returns
Section titled “Returns”{ available: false, reason }
Example
Section titled “Example”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,});