@vertigis/viewer-spec
Version:
VertiGIS Viewer Specification
55 lines (54 loc) • 1.58 kB
TypeScript
import type { Action } from "@vertigis/arcgis-extensions/support/Action";
import type { Command } from "./Command.js";
import type { Event } from "./Event.js";
import type { Operation } from "./Operation.js";
/**
* Handles messaging between parts of an application.
*/
export interface MessageBus {
/**
* Retrieves a command.
*
* @param action The command specification. Either the name of a command, or
* a list of commands and/or operations to run in sequence.
*/
command<T = void>(action: Action): Command<T>;
/**
* Retrieves an event.
*
* @param name Name of the event.
*/
event<T = void>(name: string): Event<T>;
/**
* Retrieves an operation.
*
* @param name Name of the operation.
*/
operation<T = void, TResult = undefined>(action: Action): Operation<T, TResult>;
/**
* Determines whether a command with the given name exists.
*
* @param name Name of the command.
*/
hasCommand(name: string): boolean;
/**
* Determines whether an event with the given name exists.
*
* @param name Name of the event.
*/
hasEvent(name: string): boolean;
/**
* Determines whether an operation with the given name exists.
*
* @param name Name of the operation.
*/
hasOperation(name: string): boolean;
/**
* Returns all registered commands.
*/
allCommands(): IterableIterator<Command>;
/**
* Returns all registered operations.
*/
allOperations(): IterableIterator<Operation>;
}