Class: IQMenu
core/menu.IQMenu
IQMenu - Interactive menu system
Table of contents
Constructors
Properties
- art
- autoRenderItems
- basepath
- commands
- data
- description
- hotkeys
- itemFormat
- items
- itemsX
- itemsY
- mouse
- mouseHighlightFormat
- name
- promptText
- promptX
- promptY
Methods
Constructors
constructor
• new IQMenu(options, output, artworkFn?, getRuntime?)
Parameters
| Name | Type |
|---|---|
options |
IQMenuOptions |
output |
IQOutput |
artworkFn? |
(options?: { basepath?: string }) => { render: (opts: any) => Promise<any> } |
getRuntime? |
() => { getLastRenderedMenuArtKey: () => null | string ; processSnacks: () => void ; setLastRenderedMenuArtKey: (key: string) => void ; setPromptPosition: (x: number, y: number) => void } |
Defined in
Properties
art
• Optional art: IQMenuArtOptions
Defined in
autoRenderItems
• autoRenderItems: boolean
Defined in
basepath
• Optional basepath: string
Defined in
commands
• commands: IMenuCommands
Defined in
data
• data: any
Defined in
description
• description: string
Defined in
hotkeys
• hotkeys: boolean
Defined in
itemFormat
• itemFormat: string
Defined in
items
• items: IQMenuItem[] = []
Defined in
itemsX
• Optional itemsX: number
Defined in
itemsY
• Optional itemsY: number
Defined in
mouse
• mouse: boolean
Defined in
mouseHighlightFormat
• mouseHighlightFormat: undefined | string
Defined in
name
• name: string
Defined in
promptText
• promptText: string
Defined in
promptX
• Optional promptX: number
Defined in
promptY
• Optional promptY: number
Defined in
Methods
addItem
▸ addItem(item): IQMenu
Add a menu item
Parameters
| Name | Type |
|---|---|
item |
IQMenuItem |
Returns
Defined in
addItems
▸ addItems(items): IQMenu
Add multiple menu items
Parameters
| Name | Type |
|---|---|
items |
IQMenuItem[] |
Returns
Defined in
back
▸ back(): string
Go back to parent menu
Returns
string
Defined in
executeCommand
▸ executeCommand(key): Promise<any>
Execute a command by key
Parameters
| Name | Type |
|---|---|
key |
string |
Returns
Promise<any>
Defined in
getParent
▸ getParent(): null | IQMenu
Get parent menu
Returns
null | IQMenu
Defined in
prompt
▸ prompt(options): IQMenuPromptFunctions
Set up a prompt for user input
Parameters
| Name | Type |
|---|---|
options |
IQMenuPromptOptions |
Returns
Defined in
render
▸ render(callback, options?): Promise<void>
Render the menu with a loop (legacy API)
Parameters
| Name | Type |
|---|---|
callback |
(res: IQMenuLoopMessageResponse, cmdkey: Function, data?: any) => void |
options? |
IQMenuLoopOptions |
Returns
Promise<void>
Defined in
setParent
▸ setParent(parent): IQMenu
Set parent menu (for back navigation)
Parameters
| Name | Type |
|---|---|
parent |
IQMenu |
Returns
Defined in
show
▸ show(): Promise<string>
Display the menu and wait for input
Returns
Promise<string>
Defined in
stop
▸ stop(): void
Stop the menu loop
Returns
void
Defined in
waitForKey
▸ waitForKey(): Promise<string>
Wait for user command input and return the key Uses non-blocking input with event processing loop
Returns
Promise<string>