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

Merge pull request #326 from desktop/bloading

Wait to show the window until we've loaded
This commit is contained in:
Markus Olsson 2016-09-02 16:43:46 +02:00 committed by GitHub
commit a5193a71fe
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.webContents.openDevTools()
} }
this.window.show()
const now = Date.now() const now = Date.now()
this.sharedProcess.console.log(`Loading: ${now - startLoad}ms`) this.sharedProcess.console.log(`Loading: ${now - startLoad}ms`)
}) })
@ -135,6 +133,11 @@ export default class AppWindow {
this.window.focus() this.window.focus()
} }
/** Show the window. */
public show() {
this.window.show()
}
/** Send the menu event to the renderer. */ /** Send the menu event to the renderer. */
public sendMenuEvent(name: MenuEvent) { public sendMenuEvent(name: MenuEvent) {
this.window.webContents.send('menu-event', { name }) this.window.webContents.send('menu-event', { name })

View File

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

View File

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

View File

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