const {BrowserWindow} = require('electron')
const CssInjector = require('../js/css-injector');

class RadioController {

  constructor() {
    this.init();
  }

  init() {
    this.window = new BrowserWindow({
      width: 1000,
      height: 470,
      show: false,
      frame: true,
      autoHideMenuBar: true,
      webPreferences: {
        plugins: true
      },
    });

    this.window.on('close', (e) => {
      if (this.window.isVisible()) {
        e.preventDefault();
        this.window.hide();
      }
    });

    this.window.loadURL('http://www.xiami.com/radio');

    this.window.webContents.on('dom-ready', () => {
      this.window.webContents.insertCSS(CssInjector.radio);
      this.show();
    });
  }

  show() {
    if (this.window.isMinimized()) this.window.restore()
    this.window.focus()
  }
}

module.exports = RadioController;
@@ -730,28 +730,24 @@
 how() %7B%0A    
-if (
 this.window.
@@ -750,44 +750,15 @@
 dow.
-isMinimized()) this.window.restore
+show
 ()
+;
 %0A   
@@ -777,16 +777,17 @@
 .focus()
+;
 %0A  %7D%0A%7D%0A%0A

replace the deprecated methods