From 73511335421acbb4beb2d0e7f80608504315e987 Mon Sep 17 00:00:00 2001 From: Michael George Attard Date: Thu, 26 Oct 2017 21:20:30 +0200 Subject: [PATCH 1/2] Used string template instead of concatenation. --- src/main/announcement.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/main/announcement.js b/src/main/announcement.js index 662ce51c..233526ee 100644 --- a/src/main/announcement.js +++ b/src/main/announcement.js @@ -7,9 +7,7 @@ const electron = require('electron') const config = require('../config') const log = require('./log') -const ANNOUNCEMENT_URL = config.ANNOUNCEMENT_URL + - '?version=' + config.APP_VERSION + - '&platform=' + process.platform +const ANNOUNCEMENT_URL = `${config.ANNOUNCEMENT_URL}?version=${config.APP_VERSION}&platform=${process.platform}`; /** * In certain situations, the WebTorrent team may need to show an announcement to From 424d1716567ce264f9158ffe412199a74000c847 Mon Sep 17 00:00:00 2001 From: Michael George Attard Date: Thu, 26 Oct 2017 21:27:57 +0200 Subject: [PATCH 2/2] Used string template where it made sense. --- src/main/announcement.js | 3 ++- src/main/external-player.js | 4 ++-- src/main/windows/main.js | 6 +++--- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/main/announcement.js b/src/main/announcement.js index 233526ee..ca4ab019 100644 --- a/src/main/announcement.js +++ b/src/main/announcement.js @@ -7,7 +7,8 @@ const electron = require('electron') const config = require('../config') const log = require('./log') -const ANNOUNCEMENT_URL = `${config.ANNOUNCEMENT_URL}?version=${config.APP_VERSION}&platform=${process.platform}`; +const ANNOUNCEMENT_URL = + `${config.ANNOUNCEMENT_URL}?version=${config.APP_VERSION}&platform=${process.platform}` /** * In certain situations, the WebTorrent team may need to show an announcement to diff --git a/src/main/external-player.js b/src/main/external-player.js index 39b80061..3a1ac884 100644 --- a/src/main/external-player.js +++ b/src/main/external-player.js @@ -40,13 +40,13 @@ function spawn (playerPath, url, title) { function kill () { if (!proc) return - log('Killing external player, pid ' + proc.pid) + log(`Killing external player, pid ${proc.pid}`) proc.kill('SIGKILL') // kill -9 proc = null } function spawnExternal (playerPath, args) { - log('Running external media player:', playerPath + ' ' + args.join(' ')) + log('Running external media player:', `${playerPath} ${args.join(' ')}`) if (process.platform === 'darwin' && path.extname(playerPath) === '.app') { // Mac: Use executable in packaged .app bundle diff --git a/src/main/windows/main.js b/src/main/windows/main.js index 104ac132..6898ebfd 100644 --- a/src/main/windows/main.js +++ b/src/main/windows/main.js @@ -138,7 +138,7 @@ function setAspectRatio (aspectRatio) { function setBounds (bounds, maximize) { // Do nothing in fullscreen if (!main.win || main.win.isFullScreen()) { - log('setBounds: not setting bounds because we\'re in full screen') + log(`setBounds: not setting bounds because we're in full screen`) return } @@ -162,13 +162,13 @@ function setBounds (bounds, maximize) { // Assuming we're not maximized or maximizing, set the window size if (!willBeMaximized) { - log('setBounds: setting bounds to ' + JSON.stringify(bounds)) + log(`setBounds: setting bounds to ${JSON.stringify(bounds)}`) if (bounds.x === null && bounds.y === null) { // X and Y not specified? By default, center on current screen const scr = electron.screen.getDisplayMatching(main.win.getBounds()) bounds.x = Math.round(scr.bounds.x + (scr.bounds.width / 2) - (bounds.width / 2)) bounds.y = Math.round(scr.bounds.y + (scr.bounds.height / 2) - (bounds.height / 2)) - log('setBounds: centered to ' + JSON.stringify(bounds)) + log(`setBounds: centered to ${JSON.stringify(bounds)}`) } // Resize the window's content area (so window border doesn't need to be taken // into account)