You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If your command is only able to run under certain conditions, then consider using [`checkCallback`](../api/interfaces/Command.md#checkcallback) instead.
32
32
33
-
When using the `checkCallback`, Obsidian first performs a _check_to see whether the command can run. To determine whether the callback should perform a check or an action, a `checking` argument is passed to the callback.
33
+
The `checkCallback` runs twice. First, to perform a preliminary check to determine whether the command can run. Second, to perform the action.
34
34
35
-
- If `checking` is set to `true`, perform a check.
35
+
Since time may pass between the two runs, you need to perform the check during both calls.
36
+
37
+
To determine whether the callback should perform a preliminary check or an action, a `checking` argument is passed to the callback.
38
+
39
+
- If `checking` is set to `true`, perform a preliminary check.
36
40
- If `checking` is set to `false`, perform an action.
37
41
42
+
The command in the following example depends on a required value. In both runs, the callback checks that the value is present but only performs the action if `checking` is `false`.
0 commit comments