Is there a way to detect if the console window is open?

So I'm putting together this error code thing and I'd really like it if I could somehow detect if the console is already open or not
There's a window.console object but from what I can tell there doesn't seem to be a non-janky way to detect whether the console window is open. window.console !== null always returns true, and it doesn't seem to have any properties that would be conducive to checking its openness. There is a kinda hacky way where you print something and return how long it took (because it takes ever so slightly longer if the window is open) but that's not really 100% reliable.
I'm not sure about in browser detection fo the console but using MV's nwjs wrapper you can simply use built-in method to detect if it's open.

EDIT: Forgot you need to require the nw gui first. I fixed snippet to match.

Code:
require('nw.gui').Window.get().isDevToolsOpen()

// The above method won't work if it's browser environment. So do a check to ensure.
  if (Utils.isNwjs()){
    require('nw.gui').Window.get().isDevToolsOpen()
  } else {
   console.warn('Uh Oh, this method is unavailable!')
}

Original thread: https://forums.rpgmakerweb.com/threads/is-there-a-way-to-detect-if-the-console-window-is-open.76051/