1
0
mirror of https://github.com/desktop/desktop synced 2024-07-02 15:48:39 +00:00

Wait to show the window until we've loaded

This commit is contained in:
joshaber 2016-09-01 15:41:59 -04:00
parent da3432cd14
commit 2a591c8060
4 changed files with 18 additions and 3 deletions

View File

@ -58,8 +58,6 @@ export default class AppWindow {
this.window.webContents.openDevTools()
}
this.window.show()
const now = Date.now()
this.sharedProcess.console.log(`Loading: ${now - startLoad}ms`)
})
@ -135,6 +133,11 @@ export default class AppWindow {
this.window.focus()
}
/** Show the window. */
public show() {
this.window.show()
}
/** Send the menu event to the renderer. */
public sendMenuEvent(name: MenuEvent) {
this.window.webContents.send('menu-event', { name })

View File

@ -112,6 +112,10 @@ app.on('ready', () => {
fatalError(`Unknown menu id: ${id}`)
}
})
ipcMain.on('show-main-window', () => {
getMainWindow().show()
})
})
app.on('activate', () => {

View File

@ -12,6 +12,7 @@ import { URLActionType } from '../lib/parse-url'
import Repository from '../models/repository'
import { find } from '../lib/find'
import { getDefaultDir } from './lib/default-dir'
import { showMainWindow } from './main-process-proxy'
if (!process.env.TEST_ENV) {
/* This is the magic trigger for webpack to go compile
@ -23,7 +24,9 @@ const appStore = new AppStore()
const gitUserStore = new GitUserStore(new GitUserDatabase('GitUserDatabase'))
const cloningRepositoriesStore = new CloningRepositoriesStore()
const dispatcher = new Dispatcher(appStore, gitUserStore, cloningRepositoriesStore)
dispatcher.loadInitialState()
dispatcher.loadInitialState().then(() => {
showMainWindow()
})
document.body.classList.add(`platform-${process.platform}`)

View File

@ -10,3 +10,8 @@ export function showPopupAppMenu() {
export function setMenuEnabled(id: MenuIDs, enabled: boolean) {
ipcRenderer.send('set-menu-enabled', [ { id, enabled } ])
}
/** Show the main window. */
export function showMainWindow() {
ipcRenderer.send('show-main-window')
}