2011-09-13 11 views
1

このコードは、ドアハンガーのポップアップを表示するために機能します。しかし、オプションの下でタイムアウトを使用したい場合、ポップアップ通知が表示されません。PopupNotificationのタイムアウト問題JavaScript XUL

構文:

Notification show(browser,id,message,anchorID,mainAction,secondaryActions,options); 

マイコード:

PopupNotifications.show(gBrowser.selectedBrowser, "PDE-popup", 
"Hi, there!, You can Build a PaDE by clicking on the PDE button!!", 
null, /* anchor ID */ 
{ 
    label: "Build PDE", 
    accessKey: "D", 

    callback: function() { 
       if(nodeSRC!=null) pde.emptyNodeSRC(nodeSRC); 

    window.openDialog("chrome://PDE/content/PDEBuilder.xul", "hello", "chrome,width=400,height=360",userContent, nodeSRC); 

    } 
},null, { timeout: Date.now() + 10000, 
          persistWhileVisible: false }); 

1.Whatのこのコードで間違っていますか? 2.このドアハンガーポップアップをツールバーのボタンに表示するにはどうしたらいいですか? これは私が10秒にポップアップ通知を消えるしたいツールバーボタン

<toolbarbutton id="pde-toolbar-button" label="Detect"/> 

です!どうもありがとう。

私は二次的な選択肢がありませんので、私はnullにしましたが、タイムアウトは機能していません。

http://scenari-platform.org/svn/dev-core/trunk/Lib_XulRunner/Darwin/modules/PopupNotifications.jsm

https://developer.mozilla.org/en/JavaScript_code_modules/PopupNotifications.jsm#Notification_events

enter image description here

答えて

1
Components.utils.import('resource://app/modules/PopupNotifications.jsm'); 
var notify = new PopupNotifications(gBrowser, 
             document.getElementById("notification-popup"), 
             document.getElementById("notification-popup-box")); 

var notification = notify.show(
gBrowser.selectedBrowser, /*browser*/ 
"PDES-popup", /*id*/ 
"Hi, there!, You can Build a PDE by clicking on the PDE button!!",/*message*/ 
null, /* anchor ID */ 
/* mainAction */ 
{ 
      label: "Build PDE", 
      accessKey: "D", 

      callback: function() { 
         if(nodeSRC!=null) pde.emptyNodeSRC(nodeSRC); 

       window.openDialog("chrome://PDE/content/PDESBuilder.xul", "hello", "chrome,width=400,height=360",userContent, nodeSRC); 

      } 
     }, 
null, /* secondaryActions*/ 

{ blablal:'options'} 

); 

setTimeout(function(){ 
notification.remove(); 
}, 900); 

上記のコードは正常に動作し、最終的には私の問題のため、他のフォーラムからの明確な説明を得ました。

関連する問題