Variable commandsConst

commands: ICommandsRegistry = ...

Viewer commands registry. Use this registry to register custom commands.

To implement custom command:

  1. Define a command handler with a first viewer parameter.
  2. Register command handler in the commands registry by calling the commands.registerCommand.
import { commands, Viewer } from "@inweb/viewer-visualize";

function commandHandler(viewer: Viewer, name = "world"): void {
console.log(`Hello ${name}!!!`);
}

commands.registerCommand("sayHello", commandHandler);
viewer.executeCommand("sayHello", "user");
MMNEPVFCICPMFPCPTTAAATR