This repository has been archived by the owner. It is now read-only.
Permalink
Cannot retrieve contributors at this time
Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign up
Fetching contributors…
| import { app } from 'electron' | |
| import Path from 'path' | |
| import loadConfig from './config.js' | |
| import initWindow from './initWindow.js' | |
| // load config.json manager | |
| global.config = loadConfig(Path.join(app.getPath('userData'), 'config.json')) | |
| let mainWindow | |
| // Allow only one instance of Sia-UI | |
| const shouldQuit = app.makeSingleInstance(() => { | |
| if (mainWindow) { | |
| if (mainWindow.isMinimized()) { | |
| mainWindow.restore() | |
| } | |
| mainWindow.focus() | |
| } | |
| }) | |
| if (shouldQuit) { | |
| app.quit() | |
| } | |
| // When Electron loading has finished, start Sia-UI. | |
| app.on('ready', () => { | |
| // Load mainWindow | |
| mainWindow = initWindow(config) | |
| }) | |
| // Quit once all windows have been closed. | |
| app.on('window-all-closed', () => { | |
| app.quit() | |
| }) | |
| // On quit, save the config. | |
| // There's no need to call siad.stop here, since if siad was launched by the UI, | |
| // it will be a descendant of the UI in the process tree and will therefore be killed. | |
| app.on('quit', () => { | |
| config.save() | |
| }) |