JS: Expose currentView in gui.viewDispatcher

This commit is contained in:
Willy-JL
2024-10-16 14:38:53 +01:00
parent 51d0fdc5fa
commit 72d47cfacd
3 changed files with 14 additions and 3 deletions

View File

@@ -93,9 +93,13 @@ eventLoop.subscribe(views.bytekb.input, function (_sub, data, gui, views) {
}, gui, views);
// go to the demo chooser screen when the back key is pressed
eventLoop.subscribe(gui.viewDispatcher.navigation, function (_sub, _, gui, views) {
eventLoop.subscribe(gui.viewDispatcher.navigation, function (_sub, _, gui, views, eventLoop) {
if (gui.viewDispatcher.currentView === views.demos) {
eventLoop.stop();
return;
}
gui.viewDispatcher.switchTo(views.demos);
}, gui, views);
}, gui, views, eventLoop);
// run UI
gui.viewDispatcher.switchTo(views.demos);