This repository has been archived on 2022-12-29. You can view files and clone it, but cannot push or open issues or pull requests.
2022-04-19 21:02:08 -05:00
|
|
|
import { MenuConfig, MenuPrinter } from './interface';
|
|
|
|
import { ConsolePrinter } from './console';
|
|
|
|
import { OledPrinter } from './oled';
|
|
|
|
|
|
|
|
export class Menu {
|
|
|
|
private _printer: MenuPrinter;
|
|
|
|
|
|
|
|
constructor(config: MenuConfig[], isConsole: boolean = false) {
|
|
|
|
this._printer = isConsole
|
|
|
|
? new ConsolePrinter(config)
|
|
|
|
: new OledPrinter(config);
|
|
|
|
}
|
|
|
|
|
2022-04-20 08:05:21 -05:00
|
|
|
public async getSelection(): Promise<MenuConfig> {
|
2022-04-19 21:02:08 -05:00
|
|
|
return this._printer.getSelection();
|
|
|
|
}
|
|
|
|
}
|