The EventBusWorker
Last updated
Was this helpful?
Last updated
Was this helpful?
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.
Apps can access this feature through the myWindow
method. To use the myWindow method, you have to use the greenflag()
function. Otherwise, it will return undefined. This is due to the fact that the myWindow
object is only defined after the app document is loaded.
More: , .
Here, the parameter "memory"
is used as event type. Therefore, this worker will only listen for memory events.
There are multiple types of system events, including:
memory
A system event that provides updates about a change in the file system.
The memory event has this default syntax:
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.)
The event bus will provide the folder name of the target folder or the folder where the file gets moved to.
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 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.
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.
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.
Here is a list of all settings codes and how to get the values of them: