Seeking deeper understanding of Lightning Component Events

1. Publishing Scope

Skuid has its own Event publishing framework, as well as publishing scopes. Currently, Skuid has four event scopes: Component, Page, All of Skuid, and Global.

(a) “All active pages and Lightning Components” = “Global” —> Skuid publishes the event to all Skuid components in all Skuid Pages, AND it publishes a Lightning “Application Event” which any Lightning Component can subscribe to using an aura:handler/

(b) “All active pages” = “All of Skuid” —> this event is published to all Skuid Pages, using Skuid’s internal event framework — Lightning’s Events framework is not involved.

(c) “Only this page” = the event is published to the current Skuid Page only, no other Skuid Pages are able to subscribe to the event.

2. Event Name

(a) For now yes these are the most commonly used events. There may be additional events available in the future.
(b) Yes, Skuid can publish ANY Lightning Application Event — so it can publish any of the standard Application events listed in the Lightning Components Event Reference.
(c) Yes, any custom Skuid Event can be published by simply knowing its name, and any custom Lightning Application Event can be published simply by knowing its name.

3. Event Parameters

You can pass in whatever key-value parameters you want when publishing an event. The data type can be whatever you want because Skuid sends the key-value parameters as JSON when publishing, so other Lightning Components that are subscribing to the “skuid:event” Event (say that fast :slight_smile: should be able to receive a list of records or whatever you want by deserializing the contents of the “data” param sent with the “skuid:event” event, e.g.

handleSkuidEvent : function(component, event, helper) {
var eventName = event.getParam(“name”);
if (eventName === “order.created”) {
var eventData = event.getParam(“data”);
if (eventData) {
eventData = JSON.parse(eventData);
var currentItems = component.get(“v.items”);
currentItems.unshift(eventData);
component.set(“v.items”, currentItems);
}
}
},

Event-triggered Sequences

(a) These are some standard Skuid events that we’ve designated as “subscribable” at the page level. In the future there may be additional events listed here, but any Skuid Event that’s published within a Skuid page, e.g. if a Button published a “make.me.a.sandwich” Event, could be subscribed to here at the page level.

Skuid cannot currently subscribe to other Lightning Application Events, because Skuid would have to hard-code the list of all Application Events into the Skuid package and subscribe to them all individually — obviously this wouldn’t work with customer-created Application Events. So that’s why we use the “skuid:event” Event as a shared communication channel. If customers want to publish events that Skuid can subscribe to, they need to have their components publish the “skuid:event” event.

That said, in the Millau Update 2 release, we’re adding some functionality that enables “auto-synchronization” of Skuid Models with native Lightning Components. Stay tuned for the release webinar to see more here.

(b) Inputs — these are essentially a way for you to declare the parameters that you are expecting to be published from an event, which you would like to be able to utilize in your Event-Triggered Action Sequence in the same way that you’d be able to use Inputs in a Reusable Action Sequence or a Voice-initiated Action Sequence (that’s only available on Skuid Platform, but ask about it if you’re interested :slight_smile: — you can do things like have dynamic Model / Field / Condition names passed in to your Action Sequences, or use input values in merge syntax {{$Input.someInputName}} , lots of awesome capabilities here.