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

親イベントの登録

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

1swfobject.registerObject("clippy.codeblock-0", "9");
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17//Subscribe to the parent window onscroll event.
18Sfdc.canvas(function() {
19    sr = JSON.parse('<%=signedRequestJson%>');
20    // Capture the onScrolling event of the parent window
21    Sfdc.canvas.client.subscribe(sr.client,
22        {name : 'canvas.scroll', onData : function (event) {
23            console.log("Parent's contentHeight; " + event.heights.contentHeight);
24            console.log("Parent's pageHeight; " + event.heights.pageHeight);
25            console.log("Parent's scrollTop; " + event.heights.scrollTop);
26            console.log("Parent's contentWidth; " + event.widths.contentWidth);
27            console.log("Parent's pageWidth; " + event.widths.pageWidth);
28            console.log("Parent's scrollLeft; " + event.widths.scrollLeft);
29        }}
30    );
31});