This version is still in development and is not considered stable yet. For the latest stable version, please use Spring Shell 3.4.0! |
EventLoop
EventLoop
is a central place where all eventing will be orchestrated for
a lifecycle of a component. Orchestration is usually needed around timings
of redraws and and component state updates.
Everything in an event loop is represented as a Spring Message.
TerminalUI ui = new TerminalUI(terminal);
EventLoop eventLoop = ui.getEventLoop();
Flux<? extends Message<?>> events = eventLoop.events();
events.subscribe();
Selecting key events use a build-in filtering method keyEvents().
TerminalUI ui = new TerminalUI(terminal);
EventLoop eventLoop = ui.getEventLoop();
eventLoop.keyEvents()
.doOnNext(event -> {
// do something with key event
})
.subscribe();