Reviews Overview
-
5 star
2
-
4 star
0
-
3 star
0
-
2 star
0
-
1 star
0
Publish Subscribe to Events
Overview
If you prefer working with events and being able to subscribe multiple handlers to the same event, this plugin is for you.
You have the ability to attach as many parameters to an event so that subscribers can process the event. However all parameters attached to an event are strings, so you may have to convert to and from strings to work with the data.
How to use from Event Sheets
Create Event
- Action - Create Event and specify an event name
- Action - Add parameter to include data in the event as a string
- Repeat the above step to include as many parameters as desired
- Action - Publish Event
Handle Event
- Condition - Create a condition to subscribe to the named event
- Condition - Can create subscribe conditions in multiple event sheets (Event sheets must be included for conditions to be processed)
- Expression - Use the get event parameter expression to access the data included in the published event to process (Parameters are referenced by the zero index, so the first item will be 0)
How to use through the Scripting Interface and Event Sheets
Create Event
Can be accessed in scripts like:
- const pub = runtime.objects.PubSub.getFirstInstance();
- pub._CreateEvent('test');
- pub._AddEventParameter('item1');
- pub._AddEventParameter('item2');
- pub._PublishEvent();
Subscribe to events in the event sheet.
- Follow the instructions above to subscribe to an event in the Event Sheet