Create a no-view command

In Vicinae, a no-view command is a command that directly executes from within the root search, without pushing new UI.

Declaring a no-view command

In order to declare a command as a no-view command, you need to set the mode of the command to no-view inside the manifest:

{
  "name": "my-first-command",
  "title": "My First Command",
  "subtitle": "My first subtitle",
  "description": "My first command description",
  "mode": "no-view"
}

This command declaration expects the presence of a corresponding src/my-first-command.ts entrypoint file.

No-View Lifecycle

When a no-view command is launched from the root search, the code inside the function starts executing immediately. The command is unloaded when the function returns or if another command is launched (as the command execution is non blocking).

No-view command implementation

From the entrypoint, all you need to do is to export an async function as the default export:

my-first-command.tsx

import { showToast } from '@vicinae/api';

export default async function MyFirstCommand() {
	await showToast({ title: 'Hello from no-view command!' });
}

Was this page helpful?