PopupNotification JavaScript XUL中的超时问题
此代码用于显示门挂弹出窗口。但是,当我想使用选项下的超时时,它不会显示弹出通知 语法:PopupNotification JavaScript XUL中的超时问题,javascript,popup,timeout,notifications,xul,Javascript,Popup,Timeout,Notifications,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
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秒内消失弹出通知!谢谢你们
我没有辅助选项,所以我将其设为空,但超时不起作用
上面的代码运行良好,最终从其他论坛得到了关于我的问题的清晰解释
上面的代码运行良好,最终从其他论坛得到了关于我的问题的清晰解释
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);