'On Mac OS after closing the window, it does not reopen from the dock

I have developed an electron application, and after creating its build, installed it in MacBook for testing firstly the app worked fine, but after closing the app by pressing x button on top left corner of the application the window got closed but when i left clicked on dock icon of my application it did not open neither quite app worked.

for reference i am sharing my code which i used.

**// Quit when all windows are closed.
   app.on('window-all-closed', function () {
      if (process.platform !== 'darwin') app.quit()
   })
   app.on('activate', function () {
      if (BrowserWindow.getAllWindows().length === 0) createWindow()**
   })

any reference or similar problem solution will be of great help for me



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source