menuLoop.js
1 export class MenuLoop { 2 initialize = (menuPrompt) => { 3 this.menuPrompt = menuPrompt; 4 }; 5 6 showOnce = async () => { 7 await this.menuPrompt(); 8 }; 9 10 showLoop = async () => { 11 this.running = true; 12 while (this.running) { 13 await this.menuPrompt(); 14 } 15 }; 16 17 stopLoop = () => { 18 this.running = false; 19 }; 20 }