OpenDemoVaultCommandHandler
A command handler that downloads and opens the plugin’s shipped demo vault in a new window. Only available on desktop — canExecute returns false on mobile, so the command is hidden there (no mobile notice).
This module stays cross-platform-loadable so a plugin can register it directly without a platform guard: the desktop-only opener (which statically imports Node builtins) is loaded via a dynamic import() inside execute, which only ever runs on desktop.
Import:
import { OpenDemoVaultCommandHandler } from 'obsidian-dev-utils/obsidian/command-handlers/open-demo-vault-command-handler';Signature:
export class OpenDemoVaultCommandHandler extends GlobalCommandHandlerExtends: GlobalCommandHandler
Constructor
new OpenDemoVaultCommandHandler(params: OpenDemoVaultCommandHandlerConstructorParams)Constructs a new instance.
Properties
| Property | Type | Description |
|---|---|---|
| app | App | The Obsidian app instance. |
| icon | IconName | The icon for the command. (Inherited from GlobalCommandHandler) |
| id | string | The ID of the command. (Inherited from GlobalCommandHandler) |
| name | string | The display name of the command. (Inherited from GlobalCommandHandler) |
| pluginId | string | The id of the plugin whose demo vault the command opens. |
| pluginNoticeComponent | PluginNoticeComponent | The notice component used to report problems while opening the demo vault. |
| pluginVersion | string | The currently installed version of the plugin whose demo vault the command opens. |
Methods
| Method | Returns | Description |
|---|---|---|
| buildCommand() | Command | Builds a plain Obsidian Command object with a checkCallback.(Inherited from GlobalCommandHandler) |
| canExecute() | boolean | Checks whether the command can currently execute: only on desktop. |
| execute() | Promise<void> | Executes the command, opening the plugin's demo vault. |
| onRegistered(context) | Promise<void> | Called after the command has been registered with Obsidian. Subclasses use the provided context to register menu event handlers. (Inherited from GlobalCommandHandler) |
Links to this page: