Passage à electron 1.6.5

This commit is contained in:
Benjamin Gaudé 2017-04-20 16:14:21 +02:00
parent 6b711ac315
commit ac60596bb3
7 changed files with 19 additions and 20 deletions

12
main.js
View File

@ -1,6 +1,8 @@
var app = require('app'); // Module to control application life.
var BrowserWindow = require('browser-window'); // Module to create native browser window.
var Menu = require('menu');
var app = require('electron').app; // Module to control application life.
//var BrowserWindow = require('browser-window'); // Module to create native browser window
var BrowserWindow = require('electron').BrowserWindow;
var Menu = require('electron').menu;
var isDev = process.env.NODE_ENV === 'development';
var Util = require('./'+(isDev ? 'src': 'dist')+'/util');
@ -16,7 +18,7 @@ app.on('window-all-closed', function() {
app.on('ready', function() {
// Create the browser window.
var electronScreen = require('screen');
var electronScreen = require('electron').screen;
var workArea = electronScreen.getPrimaryDisplay().workArea;
var asDesktop = process.env.PITAYA_AS_DESKTOP == 1;
@ -37,7 +39,7 @@ app.on('ready', function() {
}
// and load the index.html of the app.
mainWindow.loadUrl('file://' + __dirname + '/index.html');
mainWindow.loadURL('file://' + __dirname + '/index.html');
mainWindow.on('closed', function() {
mainWindow = null;

View File

@ -4,11 +4,10 @@
"private": "true",
"main": "main.js",
"devDependencies": {
"electron-packager": "^5.1.0",
"electron-prebuilt": "^0.37.5",
"electron": "^1.6.5",
"node-jsx": "^0.13.3",
"nodeunit": "^0.9.1",
"react-tools": "^0.13.3",
"node-jsx": "^0.13.3"
"react-tools": "^0.13.3"
},
"scripts": {
"test": "./node_modules/.bin/nodeunit test",

View File

@ -31,10 +31,7 @@ function select(state) {
// Connect App to Redux store
App = connect(select)(App);
ReactDOM.render(
<Provider store={store}>
<App />
</Provider>
,
ReactDOM.render(<Provider store={store}><App /></Provider>,
document.getElementById('pitaya')
);

View File

@ -2,7 +2,7 @@
var React = require('react');
var connect = require('react-redux').connect;
var actions = require('../../store/actions');
var dialog = require('remote').require('dialog');
var dialog = require('electron').remote.dialog;
var ProfileMenu = React.createClass({
@ -57,7 +57,7 @@ var ProfileMenu = React.createClass({
},
showSaveProfileDialog: function(defaultPath) {
return new Promise(function(resolve) {
dialog.showSaveDialog(
{

View File

@ -1,6 +1,6 @@
var Util = require('../../util');
var logger = Util.Logger;
var remote = require('remote');
var remote = require('electron').Remote;
var RUN_APP = exports.RUN_APP = 'RUN_APP';
var RUN_APP_SUCCESS = exports.RUN_APP_SUCCESS = 'RUN_APP_SUCCESS';

View File

@ -1,8 +1,9 @@
var ipc = require('ipc');
//var ipc = require('ipc');
var ipc = require('electron').ipcMain;
var isMainProcess = process.type === 'browser';
var QUIT_CMD = 'app-util:quit';
exports.quit = function(exitCode) {
if(isMainProcess) {
process.exit(exitCode);
@ -13,7 +14,6 @@ exports.quit = function(exitCode) {
// Main process, setup listeners
if(isMainProcess) {
ipc.on(QUIT_CMD, function(evt, exitCode) {
exports.quit(exitCode);
});

View File

@ -24,6 +24,7 @@ exports.load = function(profileUrl, withImports) {
for(var node, item = iterator.next(); !item.done; item = iterator.next()) {
node = item.value.node;
// For each import found, load the partial and "mount" it on the current item
if(node.import) {
var importPath = path.resolve(path.dirname(profileUrl), node.import)