Event Publish and Subscribe
You can publish and subscribe to messages for event handling.
Create, Connect, Check, and LoadThe player message bus provides a means for modules to publish and subscribe to messages for event handling. It uses OO.Player.create and onCreate to create a message bus, connect modules to the message bus, check for 3rd party modules and connect them and then load everything.
When called, the OO.Player.create() function:
- Creates a new message bus.
- Goes over the list of registered modules and creates all of them.
- Connects all the registered modules to the message bus.
When called, function onCreate(player):
- Checks for any additional modules (custom, 3rd party or other type).
- Enables these additional modules to connect to the message bus.
- Sends a message to the message bus signaling each module to start up.
You must call onCreate() before anything can happen; otherwise, the existing and additional or third-party modules are not connected to the message bus and are not initialized.