Skip to main content

CommandLibrary

aac-voice-api


Class: CommandLibrary

Defined in: commandLibrary.ts:59

CommandLibrary contains a HashMap that: Can be called by CommandMapper. Maps a String command to the corresponding GameCommand.

Constructors

Constructor

new CommandLibrary(): CommandLibrary

Defined in: commandLibrary.ts:64

Returns

CommandLibrary

Methods

add()

add(command): boolean

Defined in: commandLibrary.ts:83

Add a command (returns false if name already exists)

Parameters

ParameterType
commandGameCommand

Returns

boolean


clear()

clear(): void

Defined in: commandLibrary.ts:113

Clear all commands

Returns

void


get()

get(name): undefined | GameCommand

Defined in: commandLibrary.ts:103

Get a command by name

Parameters

ParameterType
namestring

Returns

undefined | GameCommand


has()

has(name): boolean

Defined in: commandLibrary.ts:98

Check if a command exists

Parameters

ParameterType
namestring

Returns

boolean


list()

list(): GameCommand[]

Defined in: commandLibrary.ts:108

List all commands

Returns

GameCommand[]


remove()

remove(name): boolean

Defined in: commandLibrary.ts:93

Remove a command by name

Parameters

ParameterType
namestring

Returns

boolean


getInstance()

static getInstance(): CommandLibrary

Defined in: commandLibrary.ts:71

Returns

CommandLibrary

The singleton instance of CommandLibrary.