Event System (pub/sub)
Nubo uses a simple pub/sub system with three keywords: event, sub, and pub.
Declare an event type (channel)
Section titled “Declare an event type (channel)”event messages(id: int)This defines an event named messages carrying an integer id.
Subscribe to the event
Section titled “Subscribe to the event”sub messages(id) { println("received: ", id)}The block runs when the event is published with matching data.
Publish an event
Section titled “Publish an event”This sends data 42 to all subscribers of messages.
Events work as typed channels. event pre-defines an event, sub listens for events, pub sends data
to event listeners (subscribers).