code: function getSendMethod(windowOrWebView) {
    if (!windowOrWebView) return (...a) => ipc.send(...a);
  
    if ('webContents' in windowOrWebView) {
      return (...a) => {
        d(`webContents send: ${JSON.stringify(a)}`);
        if (!windowOrWebView.webContents.isDestroyed()) {
          windowOrWebView.webContents.send(...a);
        } else {
          throw new Error(`WebContents has been destroyed`);
        }
      };
    } else {
      return (...a) => {
        d(`webView send: ${JSON.stringify(a)}`);
        windowOrWebView.send(...a);
      };
    }
  }
docs: Returns a method that will act like `ipc.send` depending on the parameter
  passed to it, so you don't have to check for `webContents`.
  
  @param  {BrowserWindow|WebView} windowOrWebView    The renderer to send to.
  
  @return {Function}                                 A function that behaves like
  `ipc.send`.
  
  @private