Module: prompt

Methods

(static) addInputFilter(filter) → {function}

Registers a new input filter.
Parameters:
Name Type Description
filter function
Since:
  • 3.2.0
Source:
Returns:
A function that can be called to remove the filter
Type
function

(static) clearCommandQueue()

Clear the command queue.
Since:
  • 3.2.0
Source:

(static) clearKeyQueue()

Clear the keypress queue.
Since:
  • 3.2.0
Source:

(static) hide()

Manually hide the prompt. It won't be shown until unhide() is called.
Source:

(static) init()

Hook into Haven's input listeners
Source:

(static) queueCommand(cmd, silentopt)

Add a command to the command queue. If the line input is ready, execute the command immediately.
Parameters:
Name Type Attributes Default Description
cmd string
silent boolean <optional>
false If true, the command isn't shown on the screen. The result of the command will still print normally.
Source:

(static) queueKeypress(key)

Add a keypress to the command queue. If the engine is waiting for a keypress, send it immediately.
Parameters:
Name Type Description
key string A one-character string containing the pressed character
Since:
  • 3.2.0
Source:

(static) removeInputFilter(filter)

Removes a filter from the registered input filters.
Parameters:
Name Type Description
filter function The filter to remove
Since:
  • 3.2.0
Source:

(static) setPrefix(prefix, htmlopt) → {string}

Set the prefix of the command prompt. The prefix is usually a greater-than character (>) at the start of the command prompt. The currently active command prompt is changed, and the new prefix is used for all future command prompts until changed again.
Parameters:
Name Type Attributes Default Description
prefix
html boolean <optional>
false If true, the prefix is inserted into the DOM as HTML. Otherwise HTML is escaped and shown as-is.
Source:
Returns:
The new prefix.
Type
string

(static) setValue(value)

Set the lineinput's value.
Parameters:
Name Type Description
value
Source:

(static) submit(commandopt, silentopt)

Trigger the submit event of the lineinput.
Parameters:
Name Type Attributes Default Description
command string | null <optional>
The command to send, if null or left out the lineinput field's value is used.
silent boolean <optional>
false If true, the command isn't shown on the screen. The result of the command will still print normally.
Source:

(static) unhide()

Remove manual hiding of the prompt. It's called rather clumsily "unhide" instead of "show" to stress that it only undoes what the hide() method did, and it doesn't force the prompt to appear if it has been hidden or removed by some other means.
Source:

(inner) runCommandQueue()

If there is a command waiting in the queue, submit it to the parser. The command is then removed from the queue.
Source:

(inner) runKeyQueue()

If there is a keypress waiting in the queue, send it to the parser. The key is then removed from the queue.
Since:
  • 3.2.0
Source: