Discuz! Board

 找回密码
 立即注册
搜索
热搜: 活动 交友 discuz

Mozillar的事件系统

查看数: 5940 | 评论数: 1 | 收藏 0
关灯 | 提示:支持键盘翻页<-左 右->
    组图打开中,请稍候......
发布时间: 2015-11-15 10:38

正文摘要:

回复

hechengjin 发表于 2016-5-7 16:57:11
本帖最后由 hechengjin 于 2016-5-7 17:02 编辑

outer-window-destroyed
chrome-document-global-created

  1. function close(window) {
  2.   let deferred = defer();
  3.   let toplevelWindow = getToplevelWindow(window);
  4.   let outerId = getOuterId(toplevelWindow);
  5.   events.on("outer-window-destroyed", function onclose({subject}) {
  6.     let id = subject.QueryInterface(Ci.nsISupportsPRUint64).data;
  7.     if (id == outerId) {
  8.       events.off("outer-window-destroyed", onclose);
  9.       deferred.resolve();
  10.     }
  11.   }, true);
  12.   window.close();
  13.   return deferred.promise;
  14. }
复制代码


const events = require('../system/events');


comm-central/mozilla/addon-sdk/source/lib/sdk/system/events.js



\xulrunner\modules\commonjs\sdk\system\events.js


QQ|Archiver|手机版|小黑屋|firemail ( 粤ICP备15085507号-1 )

GMT+8, 2024-11-22 16:12 , Processed in 0.058885 second(s), 23 queries .

Powered by Discuz! X3

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表