Closed duhrer closed 7 months ago
In reading threads like this one, it seems like we can detect whether the console is open using code like:
var isOpen = false;
var consoleCheck = function () { isOpen = true; }
console.log("%c", consoleCheck);
if (isOpen) {
// Do something.
}
else {
// Do something else.
}
Another thought I've had regarding this is to use the worker to track which window is open. As long as no new window receives focus via a listener for onpageshow
or onfocus
, treat the last window as the one that's open.
We might also check to see if the current window matches chrome.windows.getLastFocused
before responding to any inputs. Then the onblur
/onpagehide
code would just need to close any open modals.
This may have to be addressed sooner rather than later, as the new onscreen keyboard I'm working on for #84 doesn't work at all unless I disable the call to destroy on blur.
This work has been merged and will be included in the upcoming 1.0 release.
Currently, we have an "input mapper manager" that checks window visibility and:
This results in constantly creating/destroying components when switching windows. Focusing on the dev tools makes the window appear to be invisible. Since we use the new rendering infrastructure, all of our markup is cleared when the component is removed. This makes it very difficult to inspect elements in our markup using the dev tools.
My gut feel is that we should collapse the input mapper manager into the input mapper and have it deactivate/reactivate itself in response to visibility changes. However, this would require careful testing to avoid unresponsive windows.
If we can figure a way to more tightly detect which window dev tools are open in, perhaps the fix can be limited to that and we can leave the input mapper manager alone.