この文章は Salesforce 機械翻訳システムを使用して翻訳されました。詳細はこちらをご参照ください。
英語に切り替える

親イベントの登録

次のコード例に、subscribe メソッドをコールして、キャンバスアプリケーションが親イベントを登録できるようにする方法を示します。この例では、ユーザが親ウィンドウでスクロールすると起動する onscroll イベントを処理します。

1//Subscribe to the parent window onscroll event.
2Sfdc.canvas(function() {
3    sr = JSON.parse('<%=signedRequestJson%>');
4    // Capture the onScrolling event of the parent window
5    Sfdc.canvas.client.subscribe(sr.client,
6        {name : 'canvas.scroll', onData : function (event) {
7            console.log("Parent's contentHeight; " + event.heights.contentHeight);
8            console.log("Parent's pageHeight; " + event.heights.pageHeight);
9            console.log("Parent's scrollTop; " + event.heights.scrollTop);
10            console.log("Parent's contentWidth; " + event.widths.contentWidth);
11            console.log("Parent's pageWidth; " + event.widths.pageWidth);
12            console.log("Parent's scrollLeft; " + event.widths.scrollLeft);
13        }}
14    );
15});