Constructor
new Console(options)
- Source:
Initialize the console class, additionally configuring any event handlers.
Parameters:
Name | Type | Description | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object |
Properties
|
Members
onClear
- Source:
Function invoked when Console#clear is called.
onInput :function
- Source:
Function invoked when asking for asynchronous user input with the read*Async functions.
This function is invoked with the string of the prompt, i.e. readIntAsync('give me an int!').
The result of invoking onPrompt will be awaited, then parsed to configrm it's the
appropriate data type (a float, in the case of readFloat, for example). If
onPrompt is undefined, window.prompt is used as a fallback.
Type:
- function
onOutput :function
- Source:
Function invoked when printing.
This function is invoked with any output, either in the case of explicit calls to `print`
or `println` or internal calls within the library. If onPrint is undefined, console.log
is used as a fallback.
Type:
- function
Methods
configure(options)
- Source:
Configure the Console instance, providing methods it invokes
when prompting for input and emitting output.
Parameters:
Name | Type | Description | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object |
Properties
|
readLinePrivate(promptString)
- Source:
Private method used to read a line.
Parameters:
Name | Type | Description |
---|---|---|
promptString |
string | The line to be printed before prompting. |
readLinePrivateAsync(promptString)
- Source:
Private method used to read a line using the read*Async methods.
Parameters:
Name | Type | Description |
---|---|---|
promptString |
string | The line to be printed before prompting. |