40 lines
1.3 KiB
TypeScript
40 lines
1.3 KiB
TypeScript
|
import { BaseItem } from './items/base-item';
|
||
|
import { SoundSet } from './interfaces/sound-set';
|
||
|
import * as EventEmitter from 'eventemitter3';
|
||
|
export declare class Menu extends EventEmitter {
|
||
|
private title;
|
||
|
private menuItems;
|
||
|
private soundSet;
|
||
|
private defaultAction;
|
||
|
private cancelAction;
|
||
|
private titleContainer;
|
||
|
private currentItem;
|
||
|
private currentIndex;
|
||
|
private container;
|
||
|
private element;
|
||
|
private DOMNodes;
|
||
|
private soundManager;
|
||
|
private keyboardManager;
|
||
|
constructor(title?: string, menuItems?: BaseItem[], soundSet?: SoundSet, defaultAction?: string, cancelAction?: string);
|
||
|
private init;
|
||
|
addItem(item: BaseItem): this;
|
||
|
setTitle(title: string): this;
|
||
|
setSoundSet(soundSet: SoundSet): this;
|
||
|
setDefaultAction(id: string): this;
|
||
|
setCancelAction(id: string): this;
|
||
|
run(element: HTMLElement): Promise<any>;
|
||
|
close(): void;
|
||
|
private appendToContainer;
|
||
|
private handleItemUpdate;
|
||
|
private onItemFocus;
|
||
|
focusNext(): void;
|
||
|
focusPrevious(): void;
|
||
|
private focusCurrentIndex;
|
||
|
getCurrentFocus(): BaseItem;
|
||
|
getContainer(): HTMLElement;
|
||
|
clickDefaultAction(): void;
|
||
|
clickCancelAction(): void;
|
||
|
private compile;
|
||
|
}
|
||
|
export * from './items';
|