onCLI([callback], remove)

Class: SwingUI.

Description:

Registers, unregisters and retrieves event handler that receive STDIN data sent by command line interface (CLI).

Parameters:

Name Type Default Description

[callback]

function

Function to handle the event, null to remove all handlers, or omit to retrieve an array of handlers.

remove

boolean

false

Removed the callback from this event

Returns:

Returns this instance of SwingUI class.

Type: SwingUI

Examples:

Registering an event handler to receive CLI input:

ui.onCLI(e => {console.log(`Received: ${e.data}`);});