mirror of https://github.com/docker/docs.git
Better IPC naming
This commit is contained in:
parent
b36388f6eb
commit
2994b23825
|
|
@ -37,12 +37,10 @@ var Containers = React.createClass({
|
|||
this.transitionTo('containerHome', {name: this.state.sorted[0].Name});
|
||||
}
|
||||
|
||||
ipc.on('notify', message => {
|
||||
if (message === 'application:update-available') {
|
||||
this.setState({
|
||||
updateAvailable: true
|
||||
});
|
||||
}
|
||||
ipc.on('application:update-available', () => {
|
||||
this.setState({
|
||||
updateAvailable: true
|
||||
});
|
||||
});
|
||||
autoUpdater.checkForUpdates();
|
||||
},
|
||||
|
|
@ -102,7 +100,7 @@ var Containers = React.createClass({
|
|||
},
|
||||
handleAutoUpdateClick: function () {
|
||||
metrics.track('Restarted to Update');
|
||||
ipc.send('command', 'application:quit-install');
|
||||
ipc.send('application:quit-install');
|
||||
},
|
||||
handleClickPreferences: function () {
|
||||
metrics.track('Opened Preferences', {
|
||||
|
|
|
|||
|
|
@ -76,8 +76,8 @@ document.onkeydown = function (e) {
|
|||
}
|
||||
};
|
||||
|
||||
ipc.on('notify', msg => {
|
||||
if (msg === 'application:quitting' && localStorage.getItem('settings.closeVMOnQuit') === 'true') {
|
||||
ipc.on('application:quitting', () => {
|
||||
if (localStorage.getItem('settings.closeVMOnQuit') === 'true') {
|
||||
machine.stop();
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -5,21 +5,20 @@ var fs = require('fs');
|
|||
var ipc = require('ipc');
|
||||
var path = require('path');
|
||||
|
||||
process.env.NODE_PATH = __dirname + '/../node_modules';
|
||||
process.env.RESOURCES_PATH = __dirname + '/../resources';
|
||||
process.env.NODE_PATH = path.join(__dirname, '/../node_modules');
|
||||
process.env.RESOURCES_PATH = path.join(__dirname, '/../resources');
|
||||
process.chdir(path.join(__dirname, '..'));
|
||||
process.env.PATH = '/usr/local/bin:' + process.env.PATH;
|
||||
|
||||
var size = {}, settingsjson = {};
|
||||
try {
|
||||
var sizeFile = JSON.parse(fs.readFileSync(path.join(process.env[(process.platform === 'win32') ? 'USERPROFILE' : 'HOME'], 'Library', 'Application\ Support', 'Kitematic', 'size')));
|
||||
size = sizeFile;
|
||||
size = JSON.parse(fs.readFileSync(path.join(process.env[(process.platform === 'win32') ? 'USERPROFILE' : 'HOME'], 'Library', 'Application\ Support', 'Kitematic', 'size')));
|
||||
} catch (err) {}
|
||||
try {
|
||||
settingsjson = JSON.parse(fs.readFileSync(path.join(__dirname, '..', 'settings.json'), 'utf8'));
|
||||
} catch (err) {}
|
||||
|
||||
app.on('ready', function() {
|
||||
app.on('ready', function () {
|
||||
var mainWindow = new BrowserWindow({
|
||||
width: size.width || 1000,
|
||||
height: size.height || 700,
|
||||
|
|
@ -29,6 +28,7 @@ app.on('ready', function() {
|
|||
frame: false,
|
||||
show: true
|
||||
});
|
||||
|
||||
mainWindow.loadUrl(path.normalize('file://' + path.join(__dirname, '..', 'build/index.html')));
|
||||
|
||||
app.on('activate-with-no-open-windows', function () {
|
||||
|
|
@ -39,13 +39,11 @@ app.on('ready', function() {
|
|||
});
|
||||
|
||||
app.on('before-quit', function () {
|
||||
mainWindow.webContents.send('notify', 'application:quitting');
|
||||
mainWindow.webContents.send('application:quitting');
|
||||
});
|
||||
|
||||
ipc.on('command', function (event, arg) {
|
||||
if (arg === 'application:quit-install') {
|
||||
autoUpdater.quitAndInstall();
|
||||
}
|
||||
ipc.on('application:quit-install', function () {
|
||||
autoUpdater.quitAndInstall();
|
||||
});
|
||||
|
||||
mainWindow.webContents.on('new-window', function (e) {
|
||||
|
|
@ -83,7 +81,7 @@ app.on('ready', function() {
|
|||
autoUpdater.on('update-downloaded', function (e, releaseNotes, releaseName, releaseDate, updateURL) {
|
||||
console.log('Update downloaded.');
|
||||
console.log(releaseNotes, releaseName, releaseDate, updateURL);
|
||||
mainWindow.webContents.send('notify', 'application:update-available');
|
||||
mainWindow.webContents.send('application:update-available');
|
||||
});
|
||||
|
||||
autoUpdater.on('error', function (e, error) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue