open-stage-control/main/server-electron.js
jean-emmanuel bbb1080b93 - major style refactoring, we're going flat flat flat
- stylesheets splitting !
- removed sync.sass.js and css recompile switch : now using node sass and watcher during dev
  - no need to restart the whole app now, ctrl+r just refreshes the window
2016-03-18 01:38:28 +01:00

82 lines
1.8 KiB
JavaScript
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

var path = require('path')
module.exports = function(settings,app,ipc,browserWindow) {
window = new browserWindow({
width: 800,
height: 600,
icon: path.resolve(__dirname + '/../resources/images/logo.png'),
title:settings.read('appName'),
autoHideMenuBar:true,
backgroundColor:'#1a1d22',
// show:false
})
window.loadURL('file://' + __dirname + '/../browser/index.html')
window.on('closed', function() {
window = null
})
var Menu = require('menu')
Menu.setApplicationMenu(Menu.buildFromTemplate(
[
{
label: 'View',
submenu: [
{
label: 'Restart',
accelerator: 'CmdOrCtrl+R',
click: function(){
window.reload()
}
},
{
label: 'Toggle DevTools',
accelerator: 'F12',
click: function() { window.toggleDevTools(); }
},
{
label: 'Toggle Fullscreen',
accelerator: 'F11',
click: function() { window.setFullScreen(!window.isFullScreen()); }
}
]
},
]
))
// mainProcess > renderProcess ipc shorthand
ipc.send = function(name,data) {
window.webContents.send(name,data)
}
// ipc bindings
var bindCallbacks = function(callbacks) {
var bindCallback = function(i) {
ipc.on(i,function(event,data){
callbacks[i](data)
})
}
for (i in callbacks) {
bindCallback(i)
}
ipc.on('ready',function(){
window.show()
})
}
return {
ipc:ipc,
bindCallbacks:bindCallbacks
}
}