We're currently using an aura component with the <force:canvasApp>
component to embed our Canvas App. As mentioned in the answer to this post, Sfdc.canvas
is not fully exposed to the aura component. I've attempted to load canvas-all.js
into the aura component using <ltng:require>
, but from the aura component's controller/helper javascript files, I can't get Sfdc.canvas.parent
to show up (even though the browser console shows Sfdc.canvas.parent
as existing).
Does anyone have a working example of firing a custom canvas app event via Sfdc.canvas.parent.publish
from an aura component into the embedded Canvas App? Any other way to fire an event from Lightning to the Canvas App?
Update (Edit 1)
As suggested by @rzr below, using postMessage()
from the outer iframe in the Canvas App would do the job (you can see an example by @studds here and postMessage()
in action to communicate between Lightning and a VF page here). Only problem is that it is seemingly impossible to touch the DOM inside the <force:canvasApp>
component as per Lightning Locker DOM security.
Does anyone know how to send any communications from Lightning to the embedded <force:canvasApp>
app?