Distributed Event Manager (DEM)¶
The DEM is a dedicated communication channel between Union and your application and is required for Union to work.
To establish the DEM, simply reference Union’s ClientEventHub JavaScript located at \[UNION\_URL\]/assets/client-event-hub\[.min\].js
.
Most events broadcast through the DEM are handled for you, however, you may also need to use the DEM in code for various reasons. Once the DEM is established, it can be accessed on a window variable named eventHub.
EventHub’s Methods¶
subscribe¶
Subscribes to an event emitted by Union.
Argument | Type | Description |
---|---|---|
name |
string |
Name of the event you are subscribing to |
callback |
function |
Callback to be invoked when the event occurs. A payload will be passed to the method when applicable |
emit¶
Argument | Type | Description |
---|---|---|
name |
string |
Name of the event you are broadcasting |
payload |
any |
Payload you want to be provided to subscribers |
1 2 3 4 5 |
|