Toolkit

TK.Event

Subscribe for events

{
    Elements: {
        Events: {
            _: TK.Event,
            Subscribe: ["Test"], // Subscribe for event type Test
            Receive: function(eventType, eventData) {
                this.Parent.Elements.ReceivedEvents.Add({ 
                    _: "p", innerHTML: eventData
                });
            }
        },
        ReceivedEvents: {
            innerHTML: "Events received will be displayed here"
        }
    }
}

Send event

{
    _: "button",
    innerHTML: "Press me and look at the example output above",
    onclick: function() {
        TK.Event.Send("Test", "This is the data")
    }
}