+ Start a Discussion

Application event not working in lightning out

I tried the examples for application and component events from the documentation and made both of them lightning out app 

<aura:application  access="GLOBAL" extends="ltng:outApp">

When I run this compoents in a node.js app (in html) - $Lightning.createComponent("c:smContainer", {}, "lgtapp");  the component event fires/catches, but the application event does not fire ,the code that gets the event object is undefined in case of application events. 
var appEvent = $A.get("e.c:aeEvent");

Is this the expected behavior  because there is no parent container in case of a lighting  out app? is there a workaround to get the application events  working ? 

Ravi Dutt SharmaRavi Dutt Sharma

Most of the events are handled by the lightining container. When you are using lightning out, there is not container available to handle those events, hence application events wont work.

Have a look at the limitation of lightning out: https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/lightning_out_considerations.htm
Aman PathakAman Pathak
Hi  msreekmdream,

Ravi is right, there are some limitations With Sending/Receiving data from VF to Lightning and viceversa.

You need to add an event Listner at VF page to handle those Event.
something Like this,
and then handle it in a function here "VFEventHandler()"
$A.eventService.addHandler({ "event": "c:EventVFPage", "handler" : VFEventHandler});
function VFEventHandler(event)
        console.log('event is handled by VF page function');
        var myEventData1 = event.getParam("recordId");

this is all on VF page.so fire the Event from your lightning component.after that it will listen to that event on VF.

Threre are tons of example for that.Please mark this useful if it helps you.