Capturing Client-side events

What can you capture from an event:

  • name : the name of the event occurring.

  • payload : the payload of the event occurring.

  • albumId : the album Id of the album that triggered the event.

  • componentId : the component Id of the component that triggered the event

SharinPix Events in a Lightning Component

SharinPix Events emitted from a SharinPix Album( displayed within a Lightning Component) can be captured using the code snippet below.

  • The markup of the Lightning component.

|

    <aura:component implements="flexipage:availableForRecordHome,force:hasRecordId" access="global" >
        <aura:attribute name="recordId" type="String" />
        <sharinpix:SharinPix aura:id="sharinpix-cmp" AlbumId="{! v.recordId }" height="500px" />
        <aura:handler event="sharinpix:Event" action="{!c.handleEvent}" />
    </aura:component>

---|---

  • The client-side controller of the Lightning Component.

|

---|---

As seen from the above code snippet, the name of the emitted event is detected using event.getParam("name") and the event's payload is captured using event.getParam("payload").

SharinPix Events in a Visualforce Component

SharinPix Events emitted from a SharinPix Album( displayed within a Visualforce Component) can be captured using the code snippet below.

SharinPix Events in a Canvas App

SharinPix Events emitted from a SharinPix Album( displayed within a Canvas App) can be captured using the code snippet below.

After performing a specific action on the SharinPix Album, the name of the event will be output onto the browser's console:

  • The name of the event is accessed with e.data.name.

  • The payload of the event is accessed with e.data.payload.

**Info: **The **payload of the event contains useful information relative to the action being performed on the SharinPix Album. **

Last updated