@inweb/viewer-three
Version:
JavaScript library for rendering CAD and BIM files in a browser using Three.js
29 lines (28 loc) • 816 B
TypeScript
import { ICommandsRegistry } from "@inweb/viewer-core";
/**
* 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 {@link commands.registerCommand}.
*
* @example Implementing a custom command.
*
* ```javascript
* import { commands, Viewer } from "@inweb/viewer-three";
*
* function commandHandler(viewer: Viewer, name = "world"): void {
* console.log(`Hello ${name}!!!`);
* }
*
* commands.registerCommand("sayHello", commandHandler);
* ```
*
* @example Calling a custom command.
*
* ```javascript
* viewer.executeCommand("sayHello", "user");
* ```
*/
export declare const commands: ICommandsRegistry;