Skip to content

Commit

Permalink
IPCMain and IPCRenderer
Browse files Browse the repository at this point in the history
  • Loading branch information
crilleengvall committed Nov 2, 2016
1 parent 168ae11 commit cbd63b6
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 41 deletions.
5 changes: 3 additions & 2 deletions index.html
Expand Up @@ -13,7 +13,7 @@
<link rel="import" href="sections/getintouch.html">
<link rel="import" href="sections/welcome.html">
<link rel="import" href="sections/whatwedo.html">
<link rel="import" href="sections/whoweare.html">
<link rel="import" href="sections/ipcremote.html">
</head>
<body>

Expand All @@ -23,7 +23,7 @@
<nav>
<ul>
<li><a id="welcome-menu" data-section="welcome" href="#">Welcome</a></li>
<li><a id="whoweare-menu" data-section="whoweare" href="#">Who we are</a></li>
<li><a id="whoweare-menu" data-section="ipcremote" href="#">IPC/Remote</a></li>
<li><a id="whatwedo-menu" data-section="whatwedo" href="#">What we do</a></li>
<li><a id="getintouch-menu" data-section="getintouch" href="#">Get in touch</a></li>
</ul>
Expand Down Expand Up @@ -55,6 +55,7 @@
<script>
require('./assets/js/menu')
require('./assets/js/translations')
require('./assets/js/ipc')
</script>
</body>
</html>
23 changes: 23 additions & 0 deletions main.js
@@ -1,4 +1,5 @@
const electron = require('electron')
const {ipcMain} = require('electron')
var path = require('path')
// Module to control application life.
const app = electron.app
Expand All @@ -9,6 +10,7 @@ const BrowserWindow = electron.BrowserWindow
// Keep a global reference of the window object, if you don't, the window will
// be closed automatically when the JavaScript object is garbage collected.
let mainWindow
let secondWindow

function createWindow () {
// Create the browser window.
Expand All @@ -28,6 +30,7 @@ function createWindow () {
// Open the DevTools.
//mainWindow.webContents.openDevTools()


// Show the mainwindow when it is loaded and ready to show
mainWindow.once('ready-to-show', () => {
mainWindow.show()
Expand All @@ -41,9 +44,29 @@ function createWindow () {
mainWindow = null
})

secondWindow = new BrowserWindow({titleBarStyle: 'hidden',
width: 800,
height: 600,
minWidth: 800,
minHeight: 600,
backgroundColor: '#312450',
show: false,
icon: path.join(__dirname, 'assets/icons/png/64x64.png')
})

secondWindow.loadURL(`file://${__dirname}/windows/ipcwindow.html`)

require('./menu/mainmenu')
}

ipcMain.on('open-second-window', (event, arg)=> {
secondWindow.show()
})

ipcMain.on('close-second-window', (event, arg)=> {
secondWindow.hide()
})

// This method will be called when Electron has finished
// initialization and is ready to create browser windows.
// Some APIs can only be used after this event occurs.
Expand Down
37 changes: 0 additions & 37 deletions sections/whoweare.html

This file was deleted.

2 changes: 1 addition & 1 deletion translations/en.js
Expand Up @@ -30,7 +30,7 @@
"Bring all to front": "Bring all to front",
"Welcome": "Welcome",
"Hopefully this helps someone to get up to speed with electron.": "Hopefully this helps someone to get up to speed with electron.",
"Who we are": "Who we are",
"Who we are": "IPC/Remote",
"What we do": "What we do",
"Get in touch": "Get in touch",
"Learn more": "Learn more"
Expand Down
2 changes: 1 addition & 1 deletion translations/sv.js
Expand Up @@ -30,7 +30,7 @@
"Bring all to front": "Flytta fram alla",
"Welcome": "Välkommen",
"Hopefully this helps someone to get up to speed with electron.": "Förhoppningsvis hjälper detta någon att komma igång med electron",
"Who we are": "Om oss",
"Who we are": "IPC/Remote",
"What we do": "Vår verksamhet",
"Get in touch": "Kontakta oss",
"Learn more": "Läs mer"
Expand Down

0 comments on commit cbd63b6

Please sign in to comment.