PopupNotification JavaScript XUL 中的超时问题

发布于 2024-12-04 02:03:50 字数 1453 浏览 3 评论 0原文

该代码适用于我显示门衣架弹出窗口。但是,当我想在选项下使用超时时,它不会显示弹出通知。

语法:

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.这段代码有什么问题? 2. 如何将此门挂钩弹出窗口显示在我的工具栏按钮上? 这是工具栏按钮

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

我想在10秒内消失弹出通知!谢谢你们。

我没有辅助选项,所以我将其设置为空,但超时不起作用。

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< /a>

This code working for me to display the door-hanger popup. But, when I want to use the time-out under the options it wont show up the pop-up notification.

Syntax:

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

My code:

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's wrong with this code?
2. How can I place this door hanger popup to be displayed on my tool bar button?
This is the tool bar button

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

I want to disappear the pop-up notification in 10Seconds! Thank u guys.

I have no secondary options so, I made it null but the time-out is not functioning.

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

命比纸薄 2024-12-11 02:03:50
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);

上面的代码工作正常,终于从其他论坛得到了对我的问题的明确解释。

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);

The above code works fine, finally got a clear explanation from other forum for my problem.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文