Use globalShortcut to create window can unique?


#1

i use this code to create a window

if(!globalShortcut.isRegistered('CommandOrControl+Alt+S')){
      globalShortcut.register('CommandOrControl+Alt+S', function () {
        // html
        const searchPath = `file://${__dirname}/public_html/search.html`;
        let searchWin = new BrowserWindow({width: 400, height: 275});
        searchWin.loadURL(searchPath);
        searchWin.show();
        searchWin.on('close', ()=>{
          searchWin = null;
        })
      });
    }

but when i click ctrl+alt+s some time, it will create more window.
have some idea to make the window unique?

if the window is created, it show.
else it created.