simulator.createCommand() Method

The simulator.createCommand() method creates a new command, returning an object that can then be used to activate the command. If the command already exists, then the existing command is returned.

Syntax

simulator.createCommand(name, description)

Parameters

Return value

A Command object is returned.

Example

> go_faster_button = simulator.createCommand("lee/button/go_faster", "Press a button to significantly increase velocity")
Command{ name: "lee/button/go_faster" }
> go_faster_button.addEventListener("begin", (event) => { console.log("Going faster!")})
undefined
> go_faster_button.once()
Going faster!
undefined

References