Firefox扩展:窗口激活/禁用事件 [英] Firefox extension: window activate/deactive event

查看:134
本文介绍了Firefox扩展:窗口激活/禁用事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的Firefox扩展中,我尝试在浏览器窗口激活或停用时处理该事件。添加事件激活和停用到窗口基本上是工作。但是注意到,当我移动窗口时,首先停用(当我开始移动),然后激活(当我完成移动通过释放鼠标键时)发生。对于我来说,整个窗口都是活跃的。



移动Firefox窗口时,停用/激活事件对的最佳/最简单的方法是什么?非常感谢任何提示!



Christian

解决方案

如果我你可以正确地理解你,你可以使用这个:

  window.addEventListener(blur,function(){
/ / mystuff
},false);

而这个:

  window.addEventListener(focus,function(){
// mystuff
},false);


in my Firefox extension I try to handle the event when the browser window is activated or deactivated. Adding the events "activate" and "deactivate" to the window does basically work. But noticed that when I move the window, first "deactivate" (when I start moving) and then "activate" (when I finished moving through releasing the mouse key) occurs. For me, the whole time the window is active.

What is the best / simplest way to the "deactivate"/"activate" event pair when moving the Firefox window? Thanks a lot for any tips!

Christian

解决方案

If I understand you correctly, you can use this:

window.addEventListener("blur",function(){
 //mystuff
 },false);

and this:

    window.addEventListener("focus",function(){
    //mystuff
    },false);

这篇关于Firefox扩展:窗口激活/禁用事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆