diff --git a/app/main/index.js b/app/main/index.js index e2c5d1b..e0858c6 100644 --- a/app/main/index.js +++ b/app/main/index.js @@ -58,7 +58,6 @@ app.on('ready', async () => { }) mainWindow.webContents.on('will-navigate', () => { - console.log('will navigate') scanner.deactivate() }) @@ -75,7 +74,6 @@ app.on('ready', async () => { }) app.on('before-quit', () => { - console.log('before quit') PowerSaveBlocker.deactivate() }) @@ -111,6 +109,5 @@ ipcMain.on('print', (event, fileName) => { }) ipcMain.on('deactivate', () => { - console.log('deactivate') scanner.deactivate() }) diff --git a/app/main/services/bridge/index.js b/app/main/services/bridge/index.js index 24e02ad..a504a73 100644 --- a/app/main/services/bridge/index.js +++ b/app/main/services/bridge/index.js @@ -1,24 +1,34 @@ +const emit = (...args) => { + const webContents = args.shift() + + if (webContents.isDestroyed()) { + return + } + + webContents.send(...args) +} + export const onTransmitterData = (webContents) => { return (transmitter, transmitters) => { - webContents.send('transmitter-data', transmitter, transmitters) + emit(webContents, 'transmitter-data', transmitter, transmitters) } } export const onTransmitterAdded = (webContents) => { return (transmitter, transmitters) => { - webContents.send('transmitter-added', transmitter, transmitters) + emit(webContents, 'transmitter-added', transmitter, transmitters) } } export const onTransmitterRemoved = (webContents) => { return (transmitter, transmitters) => { - webContents.send('transmitter-removed', transmitter, transmitters) + emit(webContents, 'transmitter-removed', transmitter, transmitters) } } export const onReceiverAdded = (webContents) => { return (receiver, receivers) => { - webContents.send('receiver-added', receiver, receivers) + emit(webContents, 'receiver-added', receiver, receivers) receiver.on('transmitter-added', onTransmitterAdded(webContents)) receiver.on('transmitter-removed', onTransmitterRemoved(webContents)) receiver.on('transmitter-data', onTransmitterData(webContents)) @@ -27,7 +37,7 @@ export const onReceiverAdded = (webContents) => { export const onReceiverRemoved = (webContents) => { return (receiver, receivers) => { - webContents.send('receiver-removed', receiver, receivers) + emit(webContents, 'receiver-removed', receiver, receivers) } } diff --git a/app/renderer/components/sensor/report/charts/training_score/index.jsx b/app/renderer/components/sensor/report/charts/training_score/index.jsx index 0431282..1b671ff 100644 --- a/app/renderer/components/sensor/report/charts/training_score/index.jsx +++ b/app/renderer/components/sensor/report/charts/training_score/index.jsx @@ -51,7 +51,7 @@ class TrainingScoreChart extends Component { {segments({ opacity: 0.1 })} {segments({ limit: score })} - {label({ color: colors[zone], label: score.toString() })} + {label({ color: colors[zone], label: score.toFixed(2) })} ) } diff --git a/app/renderer/styles/index.js b/app/renderer/styles/index.js index 41b7a8a..ca5e580 100644 --- a/app/renderer/styles/index.js +++ b/app/renderer/styles/index.js @@ -59,6 +59,8 @@ export default (theme) => ({ }, cardName: { + whiteSpace: 'nowrap', + overflow: 'hidden', flexGrow: 1, marginLeft: theme.spacing.unit * 3, },