UNPKG

1.08 kBTypeScriptView Raw
1/** @module commands */
2import { CommandSet } from './CommandSet';
3/**
4 * An interface for commandable objects, which are part of the command design pattern.
5 * The commandable object exposes its functonality as commands and events groupped
6 * into a [[CommandSet CommandSet]].
7 *
8 * This interface is typically implemented by controllers and is used to auto generate
9 * external interfaces.
10 *
11 * @see [[CommandSet]]
12 *
13 * ### Example ###
14 *
15 * export class MyDataController implements ICommandable, IMyDataController {
16 * private _commandSet : MyDataCommandSet;
17 *
18 * public getCommandSet(): CommandSet {
19 * if (this._commandSet == null)
20 * this._commandSet = new MyDataCommandSet(this);
21 * return this._commandSet;
22 * }
23 *
24 * ...
25 * }
26 *
27 * @see [[CommandSet]] examples
28 */
29export interface ICommandable {
30 /**
31 * Gets a command set with all supported commands and events.
32 *
33 * @returns a command set with commands and events.
34 *
35 * @see [[CommandSet]]
36 */
37 getCommandSet(): CommandSet;
38}