4

There is an example in Subscribing to Parent Events that shows I can subscribe to onscroll events from the parent window using 'canvas.scroll'.

//Subscribe to the parent window onscroll event.
Sfdc.canvas(function() {
    sr = JSON.parse('<%=signedRequestJson%>');
    // Capture the onScrolling event of the parent window
    Sfdc.canvas.client.subscribe(sr.client,
        {name : 'canvas.scroll', onData : function (event) {
            console.log("Parent's contentHeight; " + event.heights.contentHeight);
            console.log("Parent's pageHeight; " + event.heights.pageHeight);
            console.log("Parent's scrollTop; " + event.heights.scrollTop);
            console.log("Parent's contentWidth; " + event.widths.contentWidth);
            console.log("Parent's pageWidth; " + event.widths.pageWidth);
            console.log("Parent's scrollLeft; " + event.widths.scrollLeft);
        }}
    );
});

What other events are there to subscribe to? I can't find any documentation beyond 'canvas.scroll'.

In particular, I'd like to know when the window is resized so I can manually resize the iframe using Sfdc.canvas.client.resize.


So I found this in the documentation:

Currently, canvas.scroll (of the parent) is the only supported parent event in the canvas namespace.

Which I thought was the answer. But then I also found 'canvas.orientation' in Handling Orientation Changes in Your Canvas App (Added Summer '14).

  • I was really hoping this was a Q&A style question. – sfdcfox Jun 24 '16 at 2:21
  • @sfdcfox It certainly started that way. I'd like to know what events I can subscribe to. I then found some docs that made it appear there was only a single event. Then I found some more that suggested there was at least another one. So I'm still uncertain about what events are available :/ – Daniel Ballinger Jun 24 '16 at 2:24
  • @sfdcfox Do you think I should split the findings from the documentation out into an answer? They aren't really a complete answer due to the contradiction. – Daniel Ballinger Jun 24 '16 at 2:32
  • I say give it like 24-48 hours and see if someone comes up with something. Being unanswered should make it more visible. I can also contribute to a bounty if you want. I believe I might have the rep to spare ;-) – sfdcfox Jun 24 '16 at 2:35
  • An egg from the docs team said they were going to look into it. Will hopefully get an official answer soon. Save your rep for a rainy day :) – Daniel Ballinger Jun 24 '16 at 2:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.