The EventBusWorker
What is NovaOS EventBusWorker
?
EventBusWorker
?NovaOS EventBusWorker is system for all of NovaOS and its apps to know what is being updated in real time, and possibly with more context.
How to access the event bus?
Basic syntax
Example
Here, the parameter "memory"
is used as event type. Therefore, this worker will only listen for memory events.
System Events
There are multiple types of system events, including:
memory
memory
A system event that provides updates about a change in the file system.
The memory event has this default syntax:
Event titles
Event titles are titles assigned for each kind of operation. Here is a list of all default event titles for the memory
event:
update
: after a file has been updated in an AFFECTED_REGION. (Affected region contains the folder, or the path of the file updated.)
settings
settings
A system event that provides updates about a change in the system settings, set through the settings application.
The settings event has this default syntax:
Here is a list of all settings codes and how to get the values of them: Settings Descriptions
Event titles
Here is a list of all default event titles for the settings
event:
set
: When the user sets a setting (key available).remove
: When the user removes a setting (key available).reset
: When the user resets all settings to defaults.
Tip
Settings update will also mean a file update in the System/
folder; you can do something like this to get a settings update with memory events:
Delivering events
Not only that you can listen to events, but the event bus also has a function to deliver your events too. Making a multi-window application, a real thing.
Basic syntax:
Events that have no listeners, will not get broadcasted.
Use cases
Whether you want to show a reflection of the virtual memory system, or you wanted to mirror the contents of an updating file while its being saved per every change, the NovaOS event bus could be used as an efficient updates system that lets you remotely do things, without spamming unwanted calls.
Last updated