firemail

标题: Mozillar的事件系统 [打印本页]

作者: hechengjin    时间: 2015-11-15 10:38
标题: Mozillar的事件系统


作者: hechengjin    时间: 2016-5-7 16:57
本帖最后由 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







欢迎光临 firemail (http://firemail.wang:8088/) Powered by Discuz! X3