For the latest stable version, please use Spring Shell 3.3.3!spring-doc.cn

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.spring-doc.cn

Everything in an event loop is represented as a Spring Message.spring-doc.cn

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().spring-doc.cn

TerminalUI ui = new TerminalUI(terminal);
EventLoop eventLoop = ui.getEventLoop();
eventLoop.keyEvents()
	.doOnNext(event -> {
		// do something with key event
	})
	.subscribe();