# What does `checking` mean in `checkCallback`?
#obsidian/api/faq
---
If you're like me, you might have seen [`checkCallback`](https://github.com/obsidianmd/obsidian-api/blob/81ab85ade4552c9116c1e10d009127e62019c923/obsidian.d.ts#L424) in the API docs and been confused as to what `checking` means.
It helps to think about how the command palette works. A simplified version of the command palette logic is as follows:
```ts
if (command.name.indexOf(userInput) && (!command.checkCallback || command.checkCallback(true))) {
// add command to list of visible commands
}
```
So, if you provide a `checkCallback` function to a [[Command]], the command palette will call `command.checkCallback(true)` to see if the Command should be available in the palette.
This has a few gotchas. If `checking` is true:
1. DO NOT mutate anything. Just because `checkCallback` was called doesn't mean the user is trying to execute your command.
2. Exit fast. `checkCallback` is called synchronously and is blocking. It will also fire on every keystroke while the palette is open. So, don't put any computationally expensive or slow logic in this branch.
## Sample Code
```ts
import type { MarkdownView } from 'obsidian';
this.addCommand({
id: "my-command",
name: "My command",
checkCallback: (checking: boolean) => {
// checking if the command should appear in the Command Palette
if (checking) {
// make sure the active view is a MarkdownView.
return !!this.app.workspace.getActiveViewOfType(MarkdownView);
}
// `checking` is false, meaning this Command was triggered
// by the user. Perform your actual command
this.executeMyPluginsCommand();
},
});
```
Not found
This page does not exist