Events for async callback in Admin UI
Publish an event in any project
Section titled “Publish an event in any project”In you C# class, issue an event by calling the static method:
var arg1 = "String me up Scotty!";var arg2 = [1, 2, 3, 4 ,5];
BongoEvents.Fire(BongoEvents.BongoExampleEvent, arg1, arg2);The BongoExampleEvent is nothing but a simple string. Please make it a habit to declare it as a const. The arguments can be any number of different values.
Add a listener in Admin UI
Section titled “Add a listener in Admin UI”In a UI component or page, add a listener withing the sockets property.
{ ...restOfComponent, sockets: { BongoExampleEvent([arg1, arg2]) { for(let num of arg2) { console.log(`Guy ${num} said: ${arg1}`) } } }}