This function is used to make the ConsoleManager handle the key events when the popup is showed.
Inside this function are defined all the keys that can be pressed and the actions to do when they are pressed.
new ButtonPopup(id, title, message, buttons, visible)
"exit" when the user exitncelrmpup with That asks for a confirm.
Param
Type
Description
id
string
The id of the popup.
title
string
The title of the popup.
message
string
The message of the popup.
buttons
Array.<string>
The buttons of the popup (default is ["Yes", "No"]).
visible
boolean
If the popup is visible. Default is false (make it appears using show()).
Example
const popup = new ButtonPopup("popup1", "Choose the option", ["YES", "NO", "?"]).show().on("confirm", (answer) => { console.log(answer) }) // show the popup and wait for the user to confirm
This function is used to draw the ButtonPopup to the screen in the middle.
Kind: instance method of ButtonPopupReturns: ButtonPopup - The instance of the ButtonPopup.
CM : ConsoleManager
the instance of ConsoleManager (singleton)
Kind: global constant
ConfirmPopup
ConfirmPopup ⇐ ButtonPopup
Kind: global class
Extends: ButtonPopup
new ConfirmPopup(id, title, message, visible)
This class is an overload of ButtonPopup that is used to create a popup wi- "exit" when the user exitncelrmNo].
Param
Type
Description
id
string
The id of the popup.
title
string
The title of the popup.
message
string
The message of the popup.
visible
boolean
If the popup is visible. Default is false (make it appears using show()).
Example
const popup = new ConfirmPopup("popup1", "Are you shure").show().on("confirm", (answer) => { console.log(answer) }) // show the popup and wait for the user to confirm
Fixes #14
Added two Widgets
ButtonPopup
Classes
EventEmitter
Constants
ConsoleManager
the instance of ConsoleManager (singleton)
Functions
This function is used to make the ConsoleManager handle the key events when the popup is showed. Inside this function are defined all the keys that can be pressed and the actions to do when they are pressed.
ButtonPopup ⇐
EventEmitter
Kind: global class Extends:
EventEmitter
EventEmitter
ButtonPopup
ButtonPopup
boolean
ButtonPopup
ButtonPopup
ButtonPopup
new ButtonPopup(id, title, message, buttons, visible)
string
string
string
Array.<string>
boolean
Example
buttonPopup.show() ⇒
ButtonPopup
This function is used to show the popup. It also register the key events and refresh the ConsoleManager.
Kind: instance method of
ButtonPopup
Returns:ButtonPopup
- The instance of the ButtonPopup.buttonPopup.hide() ⇒
ButtonPopup
This function is used to hide the popup. It also unregister the key events and refresh the ConsoleManager.
Kind: instance method of
ButtonPopup
Returns:ButtonPopup
- The instance of the ButtonPopup.buttonPopup.isVisible() ⇒
boolean
This function is used to get the visibility of the popup.
Kind: instance method of
ButtonPopup
Returns:boolean
- The visibility of the popup.buttonPopup.manageInput() ⇒
ButtonPopup
This function is used to add the ButtonPopup key listener callback to te ConsoleManager.
Kind: instance method of
ButtonPopup
Returns:ButtonPopup
- The instance of the ButtonPopup.buttonPopup.unManageInput() ⇒
ButtonPopup
This function is used to remove the ButtonPopup key listener callback to te ConsoleManager.
Kind: instance method of
ButtonPopup
Returns:ButtonPopup
- The instance of the ButtonPopup.buttonPopup.draw() ⇒
ButtonPopup
This function is used to draw the ButtonPopup to the screen in the middle.
Kind: instance method of
ButtonPopup
Returns:ButtonPopup
- The instance of the ButtonPopup.CM :
ConsoleManager
the instance of ConsoleManager (singleton)
Kind: global constant
ConfirmPopup
ConfirmPopup ⇐
ButtonPopup
Kind: global class Extends:
ButtonPopup
new ConfirmPopup(id, title, message, visible)
This class is an overload of ButtonPopup that is used to create a popup wi- "exit" when the user exitncelrmNo].
string
string
string
boolean
Example