javascript - Google Chrome: how to fetch "minimized" event? -


i try fetch events when state of window changes. far, use content script adds "resize" listener window: window.onresize = function() {...}. allows me fetch when window's state changes "normal", "maximized" , "fullscreen".

however, have no idea "minimized". minimizing window not fire "resize" events. tried use onfocuschanged api add listener, i.e., chrome.windows.onfocuschanged.addlistener(function(windowid) {...}));, has issues. firstly, if window minimize has focus, windowid = -1 (chrome.windows.window_id_none), cannot fetch window readout state. , secondly, if window doesn't have focus, onfocuschanged event not fired.

in short, how can detect when chrome window has been minimized. lot hints

i think might help:

chrome.windows.onfocuschanged.addlistener(function() {     console.log("focus changed.");      chrome.windows.getcurrent(function(window){         console.log(window.state);         if(window.state == "normal") {             console.log("it's normal.stop watch.");         } else if(window.state == "maximized"){             console.log("it's maximized.start watch.");         } else if(window.state == "minimized"){         console.log("it's minimized.start watch.");         }     }); }); 

Comments

Popular posts from this blog

html5 - What is breaking my page when printing? -

c# - must be a non-abstract type with a public parameterless constructor in redis -

ajax - PHP/JSON Login script (Twitter style) not setting sessions -