I’m writing a simple extension which pops up a window (for a radio player). I want to try and avoid having the extension popping up more than one radio player, so I want to…
- set playing=false
- If user clicks button, open a window ONLY IF playing=false
- When opening window, set “playing=true” and get and store the pop-up window ID
- Watch for closed windows, and if it’s our pop-up window ID, then set “playing=false”.
I’m getting stuck with step 4.
chrome.windows.onRemoved.addListener(function(window) {
alert (window.id);
});
…this returns “undefined” for the window.id – I’d rather it returned the windowId that has just been closed, so I can do something with it.
What is the obvious thing that I have missed?
ANSWER
chrome.windows.onRemoved.addListener(function(windowId) {
alert(windowId);
});
…as it happens.
chrome.windows.onRemovedreturnswindowId, notwindow: