Browse Source

chore: update to standard 12

Samuel Attard 6 years ago
parent
commit
558fff69e7
100 changed files with 566 additions and 567 deletions
  1. 1 1
      default_app/default_app.js
  2. 1 1
      default_app/main.js
  3. 2 2
      default_app/renderer.js
  4. 1 1
      docs/api/accelerator.md
  5. 9 9
      docs/api/app.md
  6. 11 11
      docs/api/breaking-changes.md
  7. 2 2
      docs/api/browser-view.md
  8. 17 17
      docs/api/browser-window.md
  9. 2 2
      docs/api/chrome-command-line-switches.md
  10. 5 5
      docs/api/clipboard.md
  11. 1 1
      docs/api/content-tracing.md
  12. 3 3
      docs/api/cookies.md
  13. 13 13
      docs/api/crash-reporter.md
  14. 1 1
      docs/api/debugger.md
  15. 4 5
      docs/api/desktop-capturer.md
  16. 7 7
      docs/api/dialog.md
  17. 1 1
      docs/api/download-item.md
  18. 12 12
      docs/api/frameless-window.md
  19. 1 1
      docs/api/global-shortcut.md
  20. 2 2
      docs/api/ipc-main.md
  21. 44 44
      docs/api/menu.md
  22. 4 4
      docs/api/native-image.md
  23. 1 1
      docs/api/net-log.md
  24. 2 2
      docs/api/net.md
  25. 1 1
      docs/api/power-monitor.md
  26. 1 1
      docs/api/power-save-blocker.md
  27. 9 9
      docs/api/protocol.md
  28. 3 3
      docs/api/remote.md
  29. 1 1
      docs/api/sandbox-option.md
  30. 5 5
      docs/api/screen.md
  31. 12 12
      docs/api/session.md
  32. 1 1
      docs/api/shell.md
  33. 5 5
      docs/api/synopsis.md
  34. 3 3
      docs/api/system-preferences.md
  35. 6 6
      docs/api/touch-bar.md
  36. 10 10
      docs/api/tray.md
  37. 27 27
      docs/api/web-contents.md
  38. 4 4
      docs/api/web-frame.md
  39. 2 2
      docs/api/web-request.md
  40. 2 2
      docs/api/webview-tag.md
  41. 1 1
      docs/development/upgrading-chromium.md
  42. 3 3
      docs/faq.md
  43. 10 10
      docs/tutorial/automated-testing-with-a-custom-driver.md
  44. 4 4
      docs/tutorial/first-app.md
  45. 2 2
      docs/tutorial/keyboard-shortcuts.md
  46. 3 3
      docs/tutorial/online-offline-events.md
  47. 2 2
      docs/tutorial/security.md
  48. 1 1
      docs/tutorial/testing-widevine-cdm.md
  49. 1 1
      docs/tutorial/using-pepper-flash-plugin.md
  50. 4 4
      docs/tutorial/using-selenium-and-webdriver.md
  51. 2 2
      docs/tutorial/windows-taskbar.md
  52. 4 4
      lib/browser/api/app.js
  53. 1 1
      lib/browser/api/auto-updater/auto-updater-native.js
  54. 3 3
      lib/browser/api/auto-updater/auto-updater-win.js
  55. 2 2
      lib/browser/api/box-layout.js
  56. 2 2
      lib/browser/api/browser-view.js
  57. 14 14
      lib/browser/api/browser-window.js
  58. 2 2
      lib/browser/api/button.js
  59. 8 8
      lib/browser/api/dialog.js
  60. 2 2
      lib/browser/api/in-app-purchase.js
  61. 2 2
      lib/browser/api/label-button.js
  62. 1 1
      lib/browser/api/layout-manager.js
  63. 3 3
      lib/browser/api/menu-item-roles.js
  64. 1 1
      lib/browser/api/menu-item.js
  65. 1 1
      lib/browser/api/menu-utils.js
  66. 5 5
      lib/browser/api/menu.js
  67. 32 32
      lib/browser/api/module-list.js
  68. 1 1
      lib/browser/api/navigation-controller.js
  69. 1 1
      lib/browser/api/net-log.js
  70. 6 6
      lib/browser/api/net.js
  71. 2 2
      lib/browser/api/notification.js
  72. 2 2
      lib/browser/api/power-monitor.js
  73. 1 1
      lib/browser/api/protocol.js
  74. 2 2
      lib/browser/api/screen.js
  75. 3 3
      lib/browser/api/session.js
  76. 2 2
      lib/browser/api/system-preferences.js
  77. 2 2
      lib/browser/api/text-field.js
  78. 3 3
      lib/browser/api/top-level-window.js
  79. 9 9
      lib/browser/api/touch-bar.js
  80. 2 2
      lib/browser/api/tray.js
  81. 2 2
      lib/browser/api/view.js
  82. 2 2
      lib/browser/api/web-contents-view.js
  83. 5 5
      lib/browser/api/web-contents.js
  84. 8 8
      lib/browser/chrome-extension.js
  85. 3 3
      lib/browser/desktop-capturer.js
  86. 2 2
      lib/browser/guest-view-manager.js
  87. 7 7
      lib/browser/guest-window-manager.js
  88. 2 2
      lib/browser/init.js
  89. 5 5
      lib/browser/rpc-server.js
  90. 2 2
      lib/common/api/crash-reporter.js
  91. 7 7
      lib/common/api/module-list.js
  92. 107 107
      lib/common/asar.js
  93. 1 1
      lib/common/init.js
  94. 2 2
      lib/isolated_renderer/init.js
  95. 1 1
      lib/renderer/api/desktop-capturer.js
  96. 5 5
      lib/renderer/api/exports/electron.js
  97. 4 4
      lib/renderer/api/module-list.js
  98. 5 5
      lib/renderer/api/remote.js
  99. 2 2
      lib/renderer/api/web-frame.js
  100. 3 3
      lib/renderer/chrome-api.js

+ 1 - 1
default_app/default_app.js

@@ -1,4 +1,4 @@
-const {app, BrowserWindow} = require('electron')
+const { app, BrowserWindow } = require('electron')
 const path = require('path')
 
 let mainWindow = null

+ 1 - 1
default_app/main.js

@@ -1,4 +1,4 @@
-const {app, dialog, shell, Menu} = require('electron')
+const { app, dialog, shell, Menu } = require('electron')
 
 const fs = require('fs')
 const Module = require('module')

+ 2 - 2
default_app/renderer.js

@@ -1,4 +1,4 @@
-const {remote, shell} = require('electron')
+const { remote, shell } = require('electron')
 const fs = require('fs')
 const path = require('path')
 const URL = require('url')
@@ -7,7 +7,7 @@ const electronPath = path.relative(process.cwd(), remote.process.execPath)
 Array.from(document.querySelectorAll('a[href]')).forEach(link => {
   // safely add `?utm_source=default_app
   let url = URL.parse(link.getAttribute('href'), true)
-  url.query = Object.assign(url.query, {utm_source: 'default_app'})
+  url.query = Object.assign(url.query, { utm_source: 'default_app' })
   url = URL.format(url)
 
   link.addEventListener('click', (e) => {

+ 1 - 1
docs/api/accelerator.md

@@ -16,7 +16,7 @@ using the [`register`](global-shortcut.md#globalshortcutregisteraccelerator-call
 method, i.e.
 
 ```javascript
-const {app, globalShortcut} = require('electron')
+const { app, globalShortcut } = require('electron')
 
 app.on('ready', () => {
   // Register a 'CommandOrControl+Y' shortcut listener.

+ 9 - 9
docs/api/app.md

@@ -8,7 +8,7 @@ The following example shows how to quit the application when the last window is
 closed:
 
 ```javascript
-const {app} = require('electron')
+const { app } = require('electron')
 app.on('window-all-closed', () => {
   app.quit()
 })
@@ -268,7 +268,7 @@ certificate you should prevent the default behavior with
 `event.preventDefault()` and call `callback(true)`.
 
 ```javascript
-const {app} = require('electron')
+const { app } = require('electron')
 
 app.on('certificate-error', (event, webContents, url, error, certificate, callback) => {
   if (url === 'https://github.com') {
@@ -300,7 +300,7 @@ and `callback` can be called with an entry filtered from the list. Using
 certificate from the store.
 
 ```javascript
-const {app} = require('electron')
+const { app } = require('electron')
 
 app.on('select-client-certificate', (event, webContents, url, list, callback) => {
   event.preventDefault()
@@ -335,7 +335,7 @@ should prevent the default behavior with `event.preventDefault()` and call
 `callback(username, password)` with the credentials.
 
 ```javascript
-const {app} = require('electron')
+const { app } = require('electron')
 
 app.on('login', (event, webContents, request, authInfo, callback) => {
   event.preventDefault()
@@ -375,7 +375,7 @@ Returns:
 Emitted when Electron has created a new `session`.
 
 ```javascript
-const {app} = require('electron')
+const { app } = require('electron')
 
 app.on('session-created', (event, session) => {
   console.log(session)
@@ -448,9 +448,9 @@ An example of restarting current instance immediately and adding a new command
 line argument to the new instance:
 
 ```javascript
-const {app} = require('electron')
+const { app } = require('electron')
 
-app.relaunch({args: process.argv.slice(1).concat(['--relaunch'])})
+app.relaunch({ args: process.argv.slice(1).concat(['--relaunch']) })
 app.exit(0)
 ```
 
@@ -712,7 +712,7 @@ items can be obtained using `app.getJumpListSettings()`.
 Here's a very simple example of creating a custom Jump List:
 
 ```javascript
-const {app} = require('electron')
+const { app } = require('electron')
 
 app.setJumpList([
   {
@@ -798,7 +798,7 @@ An example of activating the window of primary instance when a second instance
 starts:
 
 ```javascript
-const {app} = require('electron')
+const { app } = require('electron')
 let myWindow = null
 
 const gotTheLock = app.requestSingleInstanceLock()

+ 11 - 11
docs/api/breaking-changes.md

@@ -49,17 +49,17 @@ app.getAppMetrics()
 
 // Deprecated
 const metrics = app.getAppMetrics()
-const {memory} = metrics[0] // Deprecated property
+const { memory } = metrics[0] // Deprecated property
 ```
 
 ## `BrowserWindow`
 
 ```js
 // Deprecated
-let optionsA = {webPreferences: {blinkFeatures: ''}}
+let optionsA = { webPreferences: { blinkFeatures: '' } }
 let windowA = new BrowserWindow(optionsA)
 // Replace with
-let optionsB = {webPreferences: {enableBlinkFeatures: ''}}
+let optionsB = { webPreferences: { enableBlinkFeatures: '' } }
 let windowB = new BrowserWindow(optionsB)
 
 // Deprecated
@@ -175,9 +175,9 @@ tray.setHighlightMode('off')
 
 ```js
 // Deprecated
-webContents.openDevTools({detach: true})
+webContents.openDevTools({ detach: true })
 // Replace with
-webContents.openDevTools({mode: 'detach'})
+webContents.openDevTools({ mode: 'detach' })
 
 // Removed
 webContents.setSize(options)
@@ -190,12 +190,12 @@ webContents.setSize(options)
 // Deprecated
 webFrame.registerURLSchemeAsSecure('app')
 // Replace with
-protocol.registerStandardSchemes(['app'], {secure: true})
+protocol.registerStandardSchemes(['app'], { secure: true })
 
 // Deprecated
-webFrame.registerURLSchemeAsPrivileged('app', {secure: true})
+webFrame.registerURLSchemeAsPrivileged('app', { secure: true })
 // Replace with
-protocol.registerStandardSchemes(['app'], {secure: true})
+protocol.registerStandardSchemes(['app'], { secure: true })
 ```
 
 ## `<webview>`
@@ -232,10 +232,10 @@ The following list includes the breaking API changes made in Electron 2.0.
 
 ```js
 // Deprecated
-let optionsA = {titleBarStyle: 'hidden-inset'}
+let optionsA = { titleBarStyle: 'hidden-inset' }
 let windowA = new BrowserWindow(optionsA)
 // Replace with
-let optionsB = {titleBarStyle: 'hiddenInset'}
+let optionsB = { titleBarStyle: 'hiddenInset' }
 let windowB = new BrowserWindow(optionsB)
 ```
 
@@ -245,7 +245,7 @@ let windowB = new BrowserWindow(optionsB)
 // Removed
 menu.popup(browserWindow, 100, 200, 2)
 // Replaced with
-menu.popup(browserWindow, {x: 100, y: 200, positioningItem: 2})
+menu.popup(browserWindow, { x: 100, y: 200, positioningItem: 2 })
 ```
 
 ## `nativeImage`

+ 2 - 2
docs/api/browser-view.md

@@ -16,9 +16,9 @@ relative to its owning window. It is meant to be an alternative to the
 
 ```javascript
 // In the main process.
-const {BrowserView, BrowserWindow} = require('electron')
+const { BrowserView, BrowserWindow } = require('electron')
 
-let win = new BrowserWindow({width: 800, height: 600})
+let win = new BrowserWindow({ width: 800, height: 600 })
 win.on('closed', () => {
   win = null
 })

+ 17 - 17
docs/api/browser-window.md

@@ -6,12 +6,12 @@ Process: [Main](../glossary.md#main-process)
 
 ```javascript
 // In the main process.
-const {BrowserWindow} = require('electron')
+const { BrowserWindow } = require('electron')
 
 // Or use `remote` from the renderer process.
-// const {BrowserWindow} = require('electron').remote
+// const { BrowserWindow } = require('electron').remote
 
-let win = new BrowserWindow({width: 800, height: 600})
+let win = new BrowserWindow({ width: 800, height: 600 })
 win.on('closed', () => {
   win = null
 })
@@ -40,8 +40,8 @@ process has rendered the page for the first time if the window has not been show
 the window after this event will have no visual flash:
 
 ```javascript
-const {BrowserWindow} = require('electron')
-let win = new BrowserWindow({show: false})
+const { BrowserWindow } = require('electron')
+let win = new BrowserWindow({ show: false })
 win.once('ready-to-show', () => {
   win.show()
 })
@@ -58,9 +58,9 @@ the app feel slow. In this case, it is recommended to show the window
 immediately, and use a `backgroundColor` close to your app's background:
 
 ```javascript
-const {BrowserWindow} = require('electron')
+const { BrowserWindow } = require('electron')
 
-let win = new BrowserWindow({backgroundColor: '#2e2c29'})
+let win = new BrowserWindow({ backgroundColor: '#2e2c29' })
 win.loadURL('https://github.com')
 ```
 
@@ -72,10 +72,10 @@ to set `backgroundColor` to make app feel more native.
 By using `parent` option, you can create child windows:
 
 ```javascript
-const {BrowserWindow} = require('electron')
+const { BrowserWindow } = require('electron')
 
 let top = new BrowserWindow()
-let child = new BrowserWindow({parent: top})
+let child = new BrowserWindow({ parent: top })
 child.show()
 top.show()
 ```
@@ -88,9 +88,9 @@ A modal window is a child window that disables parent window, to create a modal
 window, you have to set both `parent` and `modal` options:
 
 ```javascript
-const {BrowserWindow} = require('electron')
+const { BrowserWindow } = require('electron')
 
-let child = new BrowserWindow({parent: top, modal: true, show: false})
+let child = new BrowserWindow({ parent: top, modal: true, show: false })
 child.loadURL('https://github.com')
 child.once('ready-to-show', () => {
   child.show()
@@ -558,7 +558,7 @@ Commands are lowercased, underscores are replaced with hyphens, and the
 e.g. `APPCOMMAND_BROWSER_BACKWARD` is emitted as `browser-backward`.
 
 ```javascript
-const {BrowserWindow} = require('electron')
+const { BrowserWindow } = require('electron')
 let win = new BrowserWindow()
 win.on('app-command', (e, cmd) => {
   // Navigate the window back when the user hits their mouse back button
@@ -692,7 +692,7 @@ an Object containing `name` and `version` properties.
 To check if a DevTools extension is installed you can run the following:
 
 ```javascript
-const {BrowserWindow} = require('electron')
+const { BrowserWindow } = require('electron')
 
 let installed = BrowserWindow.getDevToolsExtensions().hasOwnProperty('devtron')
 console.log(installed)
@@ -706,9 +706,9 @@ is emitted.
 Objects created with `new BrowserWindow` have the following properties:
 
 ```javascript
-const {BrowserWindow} = require('electron')
+const { BrowserWindow } = require('electron')
 // In this example `win` is our instance
-let win = new BrowserWindow({width: 800, height: 600})
+let win = new BrowserWindow({ width: 800, height: 600 })
 win.loadURL('https://github.com')
 ```
 
@@ -1085,7 +1085,7 @@ attached just below the window frame, but you may want to display them beneath
 a HTML-rendered toolbar. For example:
 
 ```javascript
-const {BrowserWindow} = require('electron')
+const { BrowserWindow } = require('electron')
 let win = new BrowserWindow()
 
 let toolbarRect = document.getElementById('toolbar').getBoundingClientRect()
@@ -1354,7 +1354,7 @@ The `flags` is an array that can include following `String`s:
 Sets the region of the window to show as the thumbnail image displayed when
 hovering over the window in the taskbar. You can reset the thumbnail to be
 the entire window by specifying an empty region:
-`{x: 0, y: 0, width: 0, height: 0}`.
+`{ x: 0, y: 0, width: 0, height: 0 }`.
 
 #### `win.setThumbnailToolTip(toolTip)` _Windows_
 

+ 2 - 2
docs/api/chrome-command-line-switches.md

@@ -7,7 +7,7 @@ your app's main script before the [ready][ready] event of the [app][app] module
 is emitted:
 
 ```javascript
-const {app} = require('electron')
+const { app } = require('electron')
 app.commandLine.appendSwitch('remote-debugging-port', '8315')
 app.commandLine.appendSwitch('host-rules', 'MAP * 127.0.0.1')
 
@@ -72,7 +72,7 @@ list of hosts. This flag has an effect only if used in tandem with
 For example:
 
 ```javascript
-const {app} = require('electron')
+const { app } = require('electron')
 app.commandLine.appendSwitch('proxy-bypass-list', '<local>;*.google.com;*foo.com;1.2.3.4:5678')
 ```
 

+ 5 - 5
docs/api/clipboard.md

@@ -7,7 +7,7 @@ Process: [Main](../glossary.md#main-process), [Renderer](../glossary.md#renderer
 The following example shows how to write a string to the clipboard:
 
 ```javascript
-const {clipboard} = require('electron')
+const { clipboard } = require('electron')
 clipboard.writeText('Example String')
 ```
 
@@ -15,7 +15,7 @@ On X Window systems, there is also a selection clipboard. To manipulate it
 you need to pass `selection` to each method:
 
 ```javascript
-const {clipboard} = require('electron')
+const { clipboard } = require('electron')
 clipboard.writeText('Example String', 'selection')
 console.log(clipboard.readText('selection'))
 ```
@@ -141,7 +141,7 @@ Returns `String[]` - An array of supported formats for the clipboard `type`.
 Returns `Boolean` - Whether the clipboard supports the specified `format`.
 
 ```javascript
-const {clipboard} = require('electron')
+const { clipboard } = require('electron')
 console.log(clipboard.has('<p>selection</p>'))
 ```
 
@@ -176,7 +176,7 @@ Writes the `buffer` into the clipboard as `format`.
 * `type` String (optional)
 
 ```javascript
-const {clipboard} = require('electron')
-clipboard.write({text: 'test', html: '<b>test</b>'})
+const { clipboard } = require('electron')
+clipboard.write({ text: 'test', html: '<b>test</b>' })
 ```
 Writes `data` to the clipboard.

+ 1 - 1
docs/api/content-tracing.md

@@ -14,7 +14,7 @@ module is emitted.
 
 
 ```javascript
-const {app, contentTracing} = require('electron')
+const { app, contentTracing } = require('electron')
 
 app.on('ready', () => {
   const options = {

+ 3 - 3
docs/api/cookies.md

@@ -10,7 +10,7 @@ a `Session`.
 For example:
 
 ```javascript
-const {session} = require('electron')
+const { session } = require('electron')
 
 // Query all cookies.
 session.defaultSession.cookies.get({}, (error, cookies) => {
@@ -18,13 +18,13 @@ session.defaultSession.cookies.get({}, (error, cookies) => {
 })
 
 // Query all cookies associated with a specific url.
-session.defaultSession.cookies.get({url: 'http://www.github.com'}, (error, cookies) => {
+session.defaultSession.cookies.get({ url: 'http://www.github.com' }, (error, cookies) => {
   console.log(error, cookies)
 })
 
 // Set a cookie with the given cookie data;
 // may overwrite equivalent cookies if they exist.
-const cookie = {url: 'http://www.github.com', name: 'dummy_name', value: 'dummy'}
+const cookie = { url: 'http://www.github.com', name: 'dummy_name', value: 'dummy' }
 session.defaultSession.cookies.set(cookie, (error) => {
   if (error) console.error(error)
 })

+ 13 - 13
docs/api/crash-reporter.md

@@ -8,7 +8,7 @@ The following is an example of automatically submitting a crash report to a
 remote server:
 
 ```javascript
-const {crashReporter} = require('electron')
+const { crashReporter } = require('electron')
 
 crashReporter.start({
   productName: 'YourName',
@@ -71,18 +71,18 @@ first call `start` you can call `addExtraParameter` on macOS or call `start`
 again with the new/updated `extra` parameters on Linux and Windows.
 
 ```js
- const args = [
-   `--reporter-url=${submitURL}`,
-   `--application-name=${productName}`,
-   `--crashes-directory=${crashesDirectory}`
- ]
- const env = {
-   ELECTRON_INTERNAL_CRASH_SERVICE: 1
- }
- spawn(process.execPath, args, {
-   env: env,
-   detached: true
- })
+const args = [
+  `--reporter-url=${submitURL}`,
+  `--application-name=${productName}`,
+  `--crashes-directory=${crashesDirectory}`
+]
+const env = {
+  ELECTRON_INTERNAL_CRASH_SERVICE: 1
+}
+spawn(process.execPath, args, {
+  env: env,
+  detached: true
+})
 ```
 
 **Note:** On macOS, Electron uses a new `crashpad` client for crash collection and reporting.

+ 1 - 1
docs/api/debugger.md

@@ -8,7 +8,7 @@ Chrome Developer Tools has a [special binding][rdp] available at JavaScript
 runtime that allows interacting with pages and instrumenting them.
 
 ```javascript
-const {BrowserWindow} = require('electron')
+const { BrowserWindow } = require('electron')
 let win = new BrowserWindow()
 
 try {

+ 4 - 5
docs/api/desktop-capturer.md

@@ -10,9 +10,9 @@ title is `Electron`:
 
 ```javascript
 // In the renderer process.
-const {desktopCapturer} = require('electron')
+const { desktopCapturer } = require('electron')
 
-desktopCapturer.getSources({types: ['window', 'screen']}, (error, sources) => {
+desktopCapturer.getSources({ types: ['window', 'screen'] }, (error, sources) => {
   if (error) throw error
   for (let i = 0; i < sources.length; ++i) {
     if (sources[i].name === 'Electron') {
@@ -28,9 +28,8 @@ desktopCapturer.getSources({types: ['window', 'screen']}, (error, sources) => {
             maxHeight: 720
           }
         }
-      })
-      .then((stream) => handleStream(stream))
-      .catch((e) => handleError(e))
+      }).then((stream) => handleStream(stream))
+        .catch((e) => handleError(e))
       return
     }
   }

+ 7 - 7
docs/api/dialog.md

@@ -7,15 +7,15 @@ Process: [Main](../glossary.md#main-process)
 An example of showing a dialog to select multiple files and directories:
 
 ```javascript
-const {dialog} = require('electron')
-console.log(dialog.showOpenDialog({properties: ['openFile', 'openDirectory', 'multiSelections']}))
+const { dialog } = require('electron')
+console.log(dialog.showOpenDialog({ properties: ['openFile', 'openDirectory', 'multiSelections'] }))
 ```
 
 The Dialog is opened from Electron's main thread. If you want to use the dialog
 object from a renderer process, remember to access it using the remote:
 
 ```javascript
-const {dialog} = require('electron').remote
+const { dialog } = require('electron').remote
 console.log(dialog)
 ```
 
@@ -66,10 +66,10 @@ selected when you want to limit the user to a specific type. For example:
 ```javascript
 {
   filters: [
-    {name: 'Images', extensions: ['jpg', 'png', 'gif']},
-    {name: 'Movies', extensions: ['mkv', 'avi', 'mp4']},
-    {name: 'Custom File Type', extensions: ['as']},
-    {name: 'All Files', extensions: ['*']}
+    { name: 'Images', extensions: ['jpg', 'png', 'gif'] },
+    { name: 'Movies', extensions: ['mkv', 'avi', 'mp4'] },
+    { name: 'Custom File Type', extensions: ['as'] },
+    { name: 'All Files', extensions: ['*'] }
   ]
 }
 ```

+ 1 - 1
docs/api/download-item.md

@@ -10,7 +10,7 @@ control the download item.
 
 ```javascript
 // In the main process.
-const {BrowserWindow} = require('electron')
+const { BrowserWindow } = require('electron')
 let win = new BrowserWindow()
 win.webContents.session.on('will-download', (event, item, webContents) => {
   // Set the save path, making Electron not to prompt a save dialog.

+ 12 - 12
docs/api/frameless-window.md

@@ -14,8 +14,8 @@ To create a frameless window, you need to set `frame` to `false` in
 
 
 ```javascript
-const {BrowserWindow} = require('electron')
-let win = new BrowserWindow({width: 800, height: 600, frame: false})
+const { BrowserWindow } = require('electron')
+let win = new BrowserWindow({ width: 800, height: 600, frame: false })
 win.show()
 ```
 
@@ -33,8 +33,8 @@ You can do so by specifying the `titleBarStyle` option:
 Results in a hidden title bar and a full size content window, yet the title bar still has the standard window controls (“traffic lights”) in the top left.
 
 ```javascript
-const {BrowserWindow} = require('electron')
-let win = new BrowserWindow({titleBarStyle: 'hidden'})
+const { BrowserWindow } = require('electron')
+let win = new BrowserWindow({ titleBarStyle: 'hidden' })
 win.show()
 ```
 
@@ -43,8 +43,8 @@ win.show()
 Results in a hidden title bar with an alternative look where the traffic light buttons are slightly more inset from the window edge.
 
 ```javascript
-const {BrowserWindow} = require('electron')
-let win = new BrowserWindow({titleBarStyle: 'hiddenInset'})
+const { BrowserWindow } = require('electron')
+let win = new BrowserWindow({ titleBarStyle: 'hiddenInset' })
 win.show()
 ```
 
@@ -56,8 +56,8 @@ with mouse events that occur with the standard window toolbar buttons. This
 option is only applicable for frameless windows.
 
 ```javascript
-const {BrowserWindow} = require('electron')
-let win = new BrowserWindow({titleBarStyle: 'customButtonsOnHover', frame: false})
+const { BrowserWindow } = require('electron')
+let win = new BrowserWindow({ titleBarStyle: 'customButtonsOnHover', frame: false })
 win.show()
 ```
 
@@ -67,8 +67,8 @@ By setting the `transparent` option to `true`, you can also make the frameless
 window transparent:
 
 ```javascript
-const {BrowserWindow} = require('electron')
-let win = new BrowserWindow({transparent: true, frame: false})
+const { BrowserWindow } = require('electron')
+let win = new BrowserWindow({ transparent: true, frame: false })
 win.show()
 ```
 
@@ -98,7 +98,7 @@ events, you can call the [win.setIgnoreMouseEvents(ignore)][ignore-mouse-events]
 API:
 
 ```javascript
-const {BrowserWindow} = require('electron')
+const { BrowserWindow } = require('electron')
 let win = new BrowserWindow()
 win.setIgnoreMouseEvents(true)
 ```
@@ -114,7 +114,7 @@ allowing events such as `mouseleave` to be emitted:
 let win = require('electron').remote.getCurrentWindow()
 let el = document.getElementById('clickThroughElement')
 el.addEventListener('mouseenter', () => {
-  win.setIgnoreMouseEvents(true, {forward: true})
+  win.setIgnoreMouseEvents(true, { forward: true })
 })
 el.addEventListener('mouseleave', () => {
   win.setIgnoreMouseEvents(false)

+ 1 - 1
docs/api/global-shortcut.md

@@ -13,7 +13,7 @@ not have the keyboard focus. You should not use this module until the `ready`
 event of the app module is emitted.
 
 ```javascript
-const {app, globalShortcut} = require('electron')
+const { app, globalShortcut } = require('electron')
 
 app.on('ready', () => {
   // Register a 'CommandOrControl+X' shortcut listener.

+ 2 - 2
docs/api/ipc-main.md

@@ -25,7 +25,7 @@ processes:
 
 ```javascript
 // In main process.
-const {ipcMain} = require('electron')
+const { ipcMain } = require('electron')
 ipcMain.on('asynchronous-message', (event, arg) => {
   console.log(arg) // prints "ping"
   event.sender.send('asynchronous-reply', 'pong')
@@ -39,7 +39,7 @@ ipcMain.on('synchronous-message', (event, arg) => {
 
 ```javascript
 // In renderer process (web page).
-const {ipcRenderer} = require('electron')
+const { ipcRenderer } = require('electron')
 console.log(ipcRenderer.sendSync('synchronous-message', 'ping')) // prints "pong"
 
 ipcRenderer.on('asynchronous-reply', (event, arg) => {

+ 44 - 44
docs/api/menu.md

@@ -149,42 +149,42 @@ An example of creating the application menu in the main process with the
 simple template API:
 
 ```javascript
-const {app, Menu} = require('electron')
+const { app, Menu } = require('electron')
 
 const template = [
   {
     label: 'Edit',
     submenu: [
-      {role: 'undo'},
-      {role: 'redo'},
-      {type: 'separator'},
-      {role: 'cut'},
-      {role: 'copy'},
-      {role: 'paste'},
-      {role: 'pasteandmatchstyle'},
-      {role: 'delete'},
-      {role: 'selectall'}
+      { role: 'undo' },
+      { role: 'redo' },
+      { type: 'separator' },
+      { role: 'cut' },
+      { role: 'copy' },
+      { role: 'paste' },
+      { role: 'pasteandmatchstyle' },
+      { role: 'delete' },
+      { role: 'selectall' }
     ]
   },
   {
     label: 'View',
     submenu: [
-      {role: 'reload'},
-      {role: 'forcereload'},
-      {role: 'toggledevtools'},
-      {type: 'separator'},
-      {role: 'resetzoom'},
-      {role: 'zoomin'},
-      {role: 'zoomout'},
-      {type: 'separator'},
-      {role: 'togglefullscreen'}
+      { role: 'reload' },
+      { role: 'forcereload' },
+      { role: 'toggledevtools' },
+      { type: 'separator' },
+      { role: 'resetzoom' },
+      { role: 'zoomin' },
+      { role: 'zoomout' },
+      { type: 'separator' },
+      { role: 'togglefullscreen' }
     ]
   },
   {
     role: 'window',
     submenu: [
-      {role: 'minimize'},
-      {role: 'close'}
+      { role: 'minimize' },
+      { role: 'close' }
     ]
   },
   {
@@ -202,37 +202,37 @@ if (process.platform === 'darwin') {
   template.unshift({
     label: app.getName(),
     submenu: [
-      {role: 'about'},
-      {type: 'separator'},
-      {role: 'services', submenu: []},
-      {type: 'separator'},
-      {role: 'hide'},
-      {role: 'hideothers'},
-      {role: 'unhide'},
-      {type: 'separator'},
-      {role: 'quit'}
+      { role: 'about' },
+      { type: 'separator' },
+      { role: 'services', submenu: [] },
+      { type: 'separator' },
+      { role: 'hide' },
+      { role: 'hideothers' },
+      { role: 'unhide' },
+      { type: 'separator' },
+      { role: 'quit' }
     ]
   })
 
   // Edit menu
   template[1].submenu.push(
-    {type: 'separator'},
+    { type: 'separator' },
     {
       label: 'Speech',
       submenu: [
-        {role: 'startspeaking'},
-        {role: 'stopspeaking'}
+        { role: 'startspeaking' },
+        { role: 'stopspeaking' }
       ]
     }
   )
 
   // Window menu
   template[3].submenu = [
-    {role: 'close'},
-    {role: 'minimize'},
-    {role: 'zoom'},
-    {type: 'separator'},
-    {role: 'front'}
+    { role: 'close' },
+    { role: 'minimize' },
+    { role: 'zoom' },
+    { type: 'separator' },
+    { role: 'front' }
   ]
 }
 
@@ -249,17 +249,17 @@ the user right clicks the page:
 ```html
 <!-- index.html -->
 <script>
-const {remote} = require('electron')
-const {Menu, MenuItem} = remote
+const { remote } = require('electron')
+const { Menu, MenuItem } = remote
 
 const menu = new Menu()
-menu.append(new MenuItem({label: 'MenuItem1', click() { console.log('item 1 clicked') }}))
-menu.append(new MenuItem({type: 'separator'}))
-menu.append(new MenuItem({label: 'MenuItem2', type: 'checkbox', checked: true}))
+menu.append(new MenuItem({ label: 'MenuItem1', click() { console.log('item 1 clicked') } })))
+menu.append(new MenuItem({ type: 'separator' }))
+menu.append(new MenuItem({ label: 'MenuItem2', type: 'checkbox', checked: true }))
 
 window.addEventListener('contextmenu', (e) => {
   e.preventDefault()
-  menu.popup({window: remote.getCurrentWindow()})
+  menu.popup({ window: remote.getCurrentWindow() })
 }, false)
 </script>
 ```

+ 4 - 4
docs/api/native-image.md

@@ -11,17 +11,17 @@ For example, when creating a tray or setting a window's icon, you can pass an
 image file path as a `String`:
 
 ```javascript
-const {BrowserWindow, Tray} = require('electron')
+const { BrowserWindow, Tray } = require('electron')
 
 const appIcon = new Tray('/Users/somebody/images/icon.png')
-let win = new BrowserWindow({icon: '/Users/somebody/images/window.png'})
+let win = new BrowserWindow({ icon: '/Users/somebody/images/window.png' })
 console.log(appIcon, win)
 ```
 
 Or read the image from the clipboard which returns a `NativeImage`:
 
 ```javascript
-const {clipboard, Tray} = require('electron')
+const { clipboard, Tray } = require('electron')
 const image = clipboard.readImage()
 const appIcon = new Tray(image)
 console.log(appIcon)
@@ -73,7 +73,7 @@ images/
 
 
 ```javascript
-const {Tray} = require('electron')
+const { Tray } = require('electron')
 let appIcon = new Tray('/Users/somebody/images/icon.png')
 console.log(appIcon)
 ```

+ 1 - 1
docs/api/net-log.md

@@ -5,7 +5,7 @@
 Process: [Main](../glossary.md#main-process)
 
 ```javascript
-const {netLog} = require('electron')
+const { netLog } = require('electron')
 console.log('Start recording net-logs')
 netLog.startLogging('/path/to/net-log')
 // After some network events

+ 2 - 2
docs/api/net.md

@@ -30,9 +30,9 @@ For instance, the following example quickly shows how the `net` API might be
 used:
 
 ```javascript
-const {app} = require('electron')
+const { app } = require('electron')
 app.on('ready', () => {
-  const {net} = require('electron')
+  const { net } = require('electron')
   const request = net.request('https://github.com')
   request.on('response', (response) => {
     console.log(`STATUS: ${response.statusCode}`)

+ 1 - 1
docs/api/power-monitor.md

@@ -11,7 +11,7 @@ For example:
 
 ```javascript
 const electron = require('electron')
-const {app} = electron
+const { app } = electron
 
 app.on('ready', () => {
   electron.powerMonitor.on('suspend', () => {

+ 1 - 1
docs/api/power-save-blocker.md

@@ -7,7 +7,7 @@ Process: [Main](../glossary.md#main-process)
 For example:
 
 ```javascript
-const {powerSaveBlocker} = require('electron')
+const { powerSaveBlocker } = require('electron')
 
 const id = powerSaveBlocker.start('prevent-display-sleep')
 console.log(powerSaveBlocker.isStarted(id))

+ 9 - 9
docs/api/protocol.md

@@ -8,13 +8,13 @@ An example of implementing a protocol that has the same effect as the
 `file://` protocol:
 
 ```javascript
-const {app, protocol} = require('electron')
+const { app, protocol } = require('electron')
 const path = require('path')
 
 app.on('ready', () => {
   protocol.registerFileProtocol('atom', (request, callback) => {
     const url = request.url.substr(7)
-    callback({path: path.normalize(`${__dirname}/${url}`)})
+    callback({ path: path.normalize(`${__dirname}/${url}`) })
   }, (error) => {
     if (error) console.error('Failed to register protocol')
   })
@@ -62,7 +62,7 @@ are disabled for non standard schemes. So in general if you want to register a
 custom protocol to replace the `http` protocol, you have to register it as a standard scheme:
 
 ```javascript
-const {app, protocol} = require('electron')
+const { app, protocol } = require('electron')
 
 protocol.registerStandardSchemes(['atom'])
 app.on('ready', () => {
@@ -99,7 +99,7 @@ going to be created with `scheme`. `completion` will be called with
 
 To handle the `request`, the `callback` should be called with either the file's
 path or an object that has a `path` property, e.g. `callback(filePath)` or
-`callback({path: filePath})`.
+`callback({ path: filePath })`.
 
 When `callback` is called with nothing, a number, or an object that has an
 `error` property, the `request` will fail with the `error` number you
@@ -134,10 +134,10 @@ should be called with either a `Buffer` object or an object that has the `data`,
 Example:
 
 ```javascript
-const {protocol} = require('electron')
+const { protocol } = require('electron')
 
 protocol.registerBufferProtocol('atom', (request, callback) => {
-  callback({mimeType: 'text/html', data: Buffer.from('<h5>Response</h5>')})
+  callback({ mimeType: 'text/html', data: Buffer.from('<h5>Response</h5>') })
 }, (error) => {
   if (error) console.error('Failed to register protocol')
 })
@@ -218,8 +218,8 @@ has the `data`, `statusCode`, and `headers` properties.
 Example:
 
 ```javascript
-const {protocol} = require('electron')
-const {PassThrough} = require('stream')
+const { protocol } = require('electron')
+const { PassThrough } = require('stream')
 
 function createStream (text) {
   const rv = new PassThrough() // PassThrough is also a Readable stream
@@ -245,7 +245,7 @@ It is possible to pass any object that implements the readable stream API (emits
 `data`/`end`/`error` events). For example, here's how a file could be returned:
 
 ```javascript
-const {protocol} = require('electron')
+const { protocol } = require('electron')
 const fs = require('fs')
 
 protocol.registerStreamProtocol('atom', (request, callback) => {

+ 3 - 3
docs/api/remote.md

@@ -16,8 +16,8 @@ similar to Java's [RMI][rmi]. An example of creating a browser window from a
 renderer process:
 
 ```javascript
-const {BrowserWindow} = require('electron').remote
-let win = new BrowserWindow({width: 800, height: 600})
+const { BrowserWindow } = require('electron').remote
+let win = new BrowserWindow({ width: 800, height: 600 })
 win.loadURL('https://github.com')
 ```
 
@@ -158,7 +158,7 @@ project/
 
 ```js
 // main process: main/index.js
-const {app} = require('electron')
+const { app } = require('electron')
 app.on('ready', () => { /* ... */ })
 ```
 

+ 1 - 1
docs/api/sandbox-option.md

@@ -115,7 +115,7 @@ and preload.js:
 // private scope that can access a subset of Electron renderer APIs. We must be
 // careful to not leak any objects into the global scope!
 const fs = require('fs')
-const {ipcRenderer} = require('electron')
+const { ipcRenderer } = require('electron')
 
 // read a configuration file using the `fs` module
 const buf = fs.readFileSync('allowed-popup-urls.json')

+ 5 - 5
docs/api/screen.md

@@ -10,19 +10,19 @@ module is emitted.
 `screen` is an [EventEmitter](https://nodejs.org/api/events.html#events_class_eventemitter).
 
 **Note:** In the renderer / DevTools, `window.screen` is a reserved DOM
-property, so writing `let {screen} = require('electron')` will not work.
+property, so writing `let { screen } = require('electron')` will not work.
 
 An example of creating a window that fills the whole screen:
 
 ```javascript
 const electron = require('electron')
-const {app, BrowserWindow} = electron
+const { app, BrowserWindow } = electron
 
 let win
 
 app.on('ready', () => {
-  const {width, height} = electron.screen.getPrimaryDisplay().workAreaSize
-  win = new BrowserWindow({width, height})
+  const { width, height } = electron.screen.getPrimaryDisplay().workAreaSize
+  win = new BrowserWindow({ width, height })
   win.loadURL('https://github.com')
 })
 ```
@@ -31,7 +31,7 @@ Another example of creating a window in the external display:
 
 ```javascript
 const electron = require('electron')
-const {app, BrowserWindow} = require('electron')
+const { app, BrowserWindow } = require('electron')
 
 let win
 

+ 12 - 12
docs/api/session.md

@@ -10,9 +10,9 @@ You can also access the `session` of existing pages by using the `session`
 property of [`WebContents`](web-contents.md), or from the `session` module.
 
 ```javascript
-const {BrowserWindow} = require('electron')
+const { BrowserWindow } = require('electron')
 
-let win = new BrowserWindow({width: 800, height: 600})
+let win = new BrowserWindow({ width: 800, height: 600 })
 win.loadURL('http://github.com')
 
 const ses = win.webContents.session
@@ -59,7 +59,7 @@ Process: [Main](../glossary.md#main-process)
 You can create a `Session` object in the `session` module:
 
 ```javascript
-const {session} = require('electron')
+const { session } = require('electron')
 const ses = session.fromPartition('persist:name')
 console.log(ses.getUserAgent())
 ```
@@ -80,7 +80,7 @@ Calling `event.preventDefault()` will cancel the download and `item` will not be
 available from next tick of the process.
 
 ```javascript
-const {session} = require('electron')
+const { session } = require('electron')
 session.defaultSession.on('will-download', (event, item, webContents) => {
   event.preventDefault()
   require('request')(item.getURL(), (data) => {
@@ -239,7 +239,7 @@ window.webContents.session.enableNetworkEmulation({
 })
 
 // To emulate a network outage.
-window.webContents.session.enableNetworkEmulation({offline: true})
+window.webContents.session.enableNetworkEmulation({ offline: true })
 ```
 
 #### `ses.disableNetworkEmulation()`
@@ -272,11 +272,11 @@ Calling `setCertificateVerifyProc(null)` will revert back to default certificate
 verify proc.
 
 ```javascript
-const {BrowserWindow} = require('electron')
+const { BrowserWindow } = require('electron')
 let win = new BrowserWindow()
 
 win.webContents.session.setCertificateVerifyProc((request, callback) => {
-  const {hostname} = request
+  const { hostname } = request
   if (hostname === 'github.com') {
     callback(0)
   } else {
@@ -303,7 +303,7 @@ Calling `callback(true)` will allow the permission and `callback(false)` will re
 To clear the handler, call `setPermissionRequestHandler(null)`.
 
 ```javascript
-const {session} = require('electron')
+const { session } = require('electron')
 session.fromPartition('some-partition').setPermissionRequestHandler((webContents, permission, callback) => {
   if (webContents.getURL() === 'some-host' && permission === 'notifications') {
     return callback(false) // denied.
@@ -329,7 +329,7 @@ Returning `true` will allow the permission and `false` will reject it.
 To clear the handler, call `setPermissionCheckHandler(null)`.
 
 ```javascript
-const {session} = require('electron')
+const { session } = require('electron')
 session.fromPartition('some-partition').setPermissionCheckHandler((webContents, permission) => {
   if (webContents.getURL() === 'some-host' && permission === 'notifications') {
     return false // denied
@@ -354,7 +354,7 @@ Dynamically sets whether to always send credentials for HTTP NTLM or Negotiate
 authentication.
 
 ```javascript
-const {session} = require('electron')
+const { session } = require('electron')
 // consider any url ending with `example.com`, `foobar.com`, `baz`
 // for integrated authentication.
 session.defaultSession.allowNTLMCredentialsForDomains('*example.com, *foobar.com, *baz')
@@ -441,14 +441,14 @@ A [WebRequest](web-request.md) object for this session.
 A [Protocol](protocol.md) object for this session.
 
 ```javascript
-const {app, session} = require('electron')
+const { app, session } = require('electron')
 const path = require('path')
 
 app.on('ready', function () {
   const protocol = session.fromPartition('some-partition').protocol
   protocol.registerFileProtocol('atom', function (request, callback) {
     var url = request.url.substr(7)
-    callback({path: path.normalize(`${__dirname}/${url}`)})
+    callback({ path: path.normalize(`${__dirname}/${url}`) })
   }, function (error) {
     if (error) console.error('Failed to register protocol')
   })

+ 1 - 1
docs/api/shell.md

@@ -9,7 +9,7 @@ The `shell` module provides functions related to desktop integration.
 An example of opening a URL in the user's default browser:
 
 ```javascript
-const {shell} = require('electron')
+const { shell } = require('electron')
 
 shell.openExternal('https://github.com')
 ```

+ 5 - 5
docs/api/synopsis.md

@@ -19,11 +19,11 @@ scripts to be able to use those modules.
 The main process script is like a normal Node.js script:
 
 ```javascript
-const {app, BrowserWindow} = require('electron')
+const { app, BrowserWindow } = require('electron')
 let win = null
 
 app.on('ready', () => {
-  win = new BrowserWindow({width: 800, height: 600})
+  win = new BrowserWindow({ width: 800, height: 600 })
   win.loadURL('https://github.com')
 })
 ```
@@ -36,7 +36,7 @@ extra ability to use node modules:
 <html>
 <body>
 <script>
-  const {app} = require('electron').remote
+  const { app } = require('electron').remote
   console.log(app.getVersion())
 </script>
 </body>
@@ -52,7 +52,7 @@ As of 0.37, you can use
 built-in modules.
 
 ```javascript
-const {app, BrowserWindow} = require('electron')
+const { app, BrowserWindow } = require('electron')
 
 let win
 
@@ -67,7 +67,7 @@ destructuring to access the individual modules from `electron`.
 
 ```javascript
 const electron = require('electron')
-const {app, BrowserWindow} = electron
+const { app, BrowserWindow } = electron
 
 let win
 

+ 3 - 3
docs/api/system-preferences.md

@@ -5,7 +5,7 @@
 Process: [Main](../glossary.md#main-process)
 
 ```javascript
-const {systemPreferences} = require('electron')
+const { systemPreferences } = require('electron')
 console.log(systemPreferences.isDarkMode())
 ```
 
@@ -185,8 +185,8 @@ An example of using it to determine if you should create a transparent window or
 not (transparent windows won't work correctly when DWM composition is disabled):
 
 ```javascript
-const {BrowserWindow, systemPreferences} = require('electron')
-let browserOptions = {width: 1000, height: 800}
+const { BrowserWindow, systemPreferences } = require('electron')
+let browserOptions = { width: 1000, height: 800 }
 
 // Make the window transparent only if the platform supports it.
 if (process.platform !== 'win32' || systemPreferences.isAeroGlassEnabled()) {

+ 6 - 6
docs/api/touch-bar.md

@@ -36,9 +36,9 @@ Below is an example of a simple slot machine touch bar game with a button
 and some labels.
 
 ```javascript
-const {app, BrowserWindow, TouchBar} = require('electron')
+const { app, BrowserWindow, TouchBar } = require('electron')
 
-const {TouchBarLabel, TouchBarButton, TouchBarSpacer} = TouchBar
+const { TouchBarLabel, TouchBarButton, TouchBarSpacer } = TouchBar
 
 let spinning = false
 
@@ -114,13 +114,13 @@ const finishSpin = () => {
 
 const touchBar = new TouchBar([
   spin,
-  new TouchBarSpacer({size: 'large'}),
+  new TouchBarSpacer({ size: 'large' }),
   reel1,
-  new TouchBarSpacer({size: 'small'}),
+  new TouchBarSpacer({ size: 'small' }),
   reel2,
-  new TouchBarSpacer({size: 'small'}),
+  new TouchBarSpacer({ size: 'small' }),
   reel3,
-  new TouchBarSpacer({size: 'large'}),
+  new TouchBarSpacer({ size: 'large' }),
   result
 ])
 

+ 10 - 10
docs/api/tray.md

@@ -7,16 +7,16 @@ Process: [Main](../glossary.md#main-process)
 `Tray` is an [EventEmitter][event-emitter].
 
 ```javascript
-const {app, Menu, Tray} = require('electron')
+const { app, Menu, Tray } = require('electron')
 
 let tray = null
 app.on('ready', () => {
   tray = new Tray('/path/to/my/icon')
   const contextMenu = Menu.buildFromTemplate([
-    {label: 'Item1', type: 'radio'},
-    {label: 'Item2', type: 'radio'},
-    {label: 'Item3', type: 'radio', checked: true},
-    {label: 'Item4', type: 'radio'}
+    { label: 'Item1', type: 'radio' },
+    { label: 'Item2', type: 'radio' },
+    { label: 'Item3', type: 'radio', checked: true },
+    { label: 'Item4', type: 'radio' }
   ])
   tray.setToolTip('This is my application.')
   tray.setContextMenu(contextMenu)
@@ -35,14 +35,14 @@ __Platform limitations:__
   you have to call `setContextMenu` again. For example:
 
 ```javascript
-const {app, Menu, Tray} = require('electron')
+const { app, Menu, Tray } = require('electron')
 
 let appIcon = null
 app.on('ready', () => {
   appIcon = new Tray('/path/to/my/icon')
   const contextMenu = Menu.buildFromTemplate([
-    {label: 'Item1', type: 'radio'},
-    {label: 'Item2', type: 'radio'}
+    { label: 'Item1', type: 'radio' },
+    { label: 'Item2', type: 'radio' }
   ])
 
   // Make a change to the context menu
@@ -225,9 +225,9 @@ by toggling between `'never'` and `'always'` modes when the window visibility
 changes.
 
 ```javascript
-const {BrowserWindow, Tray} = require('electron')
+const { BrowserWindow, Tray } = require('electron')
 
-const win = new BrowserWindow({width: 800, height: 600})
+const win = new BrowserWindow({ width: 800, height: 600 })
 const tray = new Tray('/path/to/my/icon')
 
 tray.on('click', () => {

+ 27 - 27
docs/api/web-contents.md

@@ -11,9 +11,9 @@ the [`BrowserWindow`](browser-window.md) object. An example of accessing the
 `webContents` object:
 
 ```javascript
-const {BrowserWindow} = require('electron')
+const { BrowserWindow } = require('electron')
 
-let win = new BrowserWindow({width: 800, height: 1500})
+let win = new BrowserWindow({ width: 800, height: 1500 })
 win.loadURL('http://github.com')
 
 let contents = win.webContents
@@ -25,7 +25,7 @@ console.log(contents)
 These methods can be accessed from the `webContents` module:
 
 ```javascript
-const {webContents} = require('electron')
+const { webContents } = require('electron')
 console.log(webContents)
 ```
 
@@ -140,7 +140,7 @@ instance, failing to do so may result in unexpected behavior. For example:
 ```javascript
 myBrowserWindow.webContents.on('new-window', (event, url) => {
   event.preventDefault()
-  const win = new BrowserWindow({show: false})
+  const win = new BrowserWindow({ show: false })
   win.once('ready-to-show', () => win.show())
   win.loadURL(url)
   event.newGuest = win
@@ -240,8 +240,8 @@ Calling `event.preventDefault()` will ignore the `beforeunload` event handler
 and allow the page to be unloaded.
 
 ```javascript
-const {BrowserWindow, dialog} = require('electron')
-const win = new BrowserWindow({width: 800, height: 600})
+const { BrowserWindow, dialog } = require('electron')
+const win = new BrowserWindow({ width: 800, height: 600 })
 win.webContents.on('will-prevent-unload', (event) => {
   const choice = dialog.showMessageBox(win, {
     type: 'question',
@@ -312,9 +312,9 @@ To only prevent the menu shortcuts, use
 [`setIgnoreMenuShortcuts`](#contentssetignoremenushortcutsignore-experimental):
 
 ```javascript
-const {BrowserWindow} = require('electron')
+const { BrowserWindow } = require('electron')
 
-let win = new BrowserWindow({width: 800, height: 600})
+let win = new BrowserWindow({ width: 800, height: 600 })
 
 win.webContents.on('before-input-event', (event, input) => {
   // For example, only enable application menu keyboard shortcuts when
@@ -535,13 +535,13 @@ first available device will be selected. `callback` should be called with
 cancel the request.
 
 ```javascript
-const {app, BrowserWindow} = require('electron')
+const { app, BrowserWindow } = require('electron')
 
 let win = null
 app.commandLine.appendSwitch('enable-experimental-web-platform-features')
 
 app.on('ready', () => {
-  win = new BrowserWindow({width: 800, height: 600})
+  win = new BrowserWindow({ width: 800, height: 600 })
   win.webContents.on('select-bluetooth-device', (event, deviceList, callback) => {
     event.preventDefault()
     let result = deviceList.find((device) => {
@@ -568,9 +568,9 @@ Emitted when a new frame is generated. Only the dirty area is passed in the
 buffer.
 
 ```javascript
-const {BrowserWindow} = require('electron')
+const { BrowserWindow } = require('electron')
 
-let win = new BrowserWindow({webPreferences: {offscreen: true}})
+let win = new BrowserWindow({ webPreferences: { offscreen: true } })
 win.webContents.on('paint', (event, dirty, image) => {
   // updateBitmap(dirty, image.getBitmap())
 })
@@ -642,8 +642,8 @@ e.g. the `http://` or `file://`. If the load should bypass http cache then
 use the `pragma` header to achieve it.
 
 ```javascript
-const {webContents} = require('electron')
-const options = {extraHeaders: 'pragma: no-cache\n'}
+const { webContents } = require('electron')
+const options = { extraHeaders: 'pragma: no-cache\n' }
 webContents.loadURL('https://github.com', options)
 ```
 
@@ -685,8 +685,8 @@ Initiates a download of the resource at `url` without navigating. The
 Returns `String` - The URL of the current web page.
 
 ```javascript
-const {BrowserWindow} = require('electron')
-let win = new BrowserWindow({width: 800, height: 600})
+const { BrowserWindow } = require('electron')
+let win = new BrowserWindow({ width: 800, height: 600 })
 win.loadURL('http://github.com')
 
 let currentURL = win.webContents.getURL()
@@ -979,7 +979,7 @@ can be obtained by subscribing to [`found-in-page`](web-contents.md#event-found-
 Stops any `findInPage` request for the `webContents` with the provided `action`.
 
 ```javascript
-const {webContents} = require('electron')
+const { webContents } = require('electron')
 webContents.on('found-in-page', (event, result) => {
   if (result.finalUpdate) webContents.stopFindInPage('clearSelection')
 })
@@ -1037,7 +1037,7 @@ the system's default printer if `deviceName` is empty and the default settings
 for printing.
 
 Calling `window.print()` in web page is equivalent to calling
-`webContents.print({silent: false, printBackground: false, deviceName: ''})`.
+`webContents.print({ silent: false, printBackground: false, deviceName: '' })`.
 
 Use `page-break-before: always; ` CSS style to force to print to a new page.
 
@@ -1080,10 +1080,10 @@ Use `page-break-before: always; ` CSS style to force to print to a new page.
 An example of `webContents.printToPDF`:
 
 ```javascript
-const {BrowserWindow} = require('electron')
+const { BrowserWindow } = require('electron')
 const fs = require('fs')
 
-let win = new BrowserWindow({width: 800, height: 600})
+let win = new BrowserWindow({ width: 800, height: 600 })
 win.loadURL('http://github.com')
 
 win.webContents.on('did-finish-load', () => {
@@ -1106,7 +1106,7 @@ Adds the specified path to DevTools workspace. Must be used after DevTools
 creation:
 
 ```javascript
-const {BrowserWindow} = require('electron')
+const { BrowserWindow } = require('electron')
 let win = new BrowserWindow()
 win.webContents.on('devtools-opened', () => {
   win.webContents.addWorkSpace(__dirname)
@@ -1167,7 +1167,7 @@ An example of showing devtools in a `<webview>` tag:
 An example of showing devtools in a `BrowserWindow`:
 
 ```js
-const {app, BrowserWindow} = require('electron')
+const { app, BrowserWindow } = require('electron')
 
 let win = null
 let devtools = null
@@ -1177,7 +1177,7 @@ app.once('ready', () => {
   devtools = new BrowserWindow()
   win.loadURL('https://github.com')
   win.webContents.setDevToolsWebContents(devtools.webContents)
-  win.webContents.openDevTools({mode: 'detach'})
+  win.webContents.openDevTools({ mode: 'detach' })
 })
 ```
 
@@ -1236,11 +1236,11 @@ An example of sending messages from the main process to the renderer process:
 
 ```javascript
 // In the main process.
-const {app, BrowserWindow} = require('electron')
+const { app, BrowserWindow } = require('electron')
 let win = null
 
 app.on('ready', () => {
-  win = new BrowserWindow({width: 800, height: 600})
+  win = new BrowserWindow({ width: 800, height: 600 })
   win.loadURL(`file://${__dirname}/index.html`)
   win.webContents.on('did-finish-load', () => {
     win.webContents.send('ping', 'whoooooooh!')
@@ -1270,7 +1270,7 @@ app.on('ready', () => {
     * `mobile` - Mobile screen type.
   * `screenSize` [Size](structures/size.md) - Set the emulated screen size (screenPosition == mobile).
   * `viewPosition` [Point](structures/point.md) - Position the view on the screen
-      (screenPosition == mobile) (default: `{x: 0, y: 0}`).
+      (screenPosition == mobile) (default: `{ x: 0, y: 0 }`).
   * `deviceScaleFactor` Integer - Set the device scale factor (if zero defaults to
       original device scale factor) (default: `0`).
   * `viewSize` [Size](structures/size.md) - Set the emulated view size (empty means no override)
@@ -1373,7 +1373,7 @@ the cursor when dragging.
 Returns `Boolean` - true if the process of saving page has been initiated successfully.
 
 ```javascript
-const {BrowserWindow} = require('electron')
+const { BrowserWindow } = require('electron')
 let win = new BrowserWindow()
 
 win.loadURL('https://github.com')

+ 4 - 4
docs/api/web-frame.md

@@ -11,7 +11,7 @@ be retrieved by certain properties and methods (e.g. `webFrame.firstChild`).
 An example of zooming current page to 200%.
 
 ```javascript
-const {webFrame} = require('electron')
+const { webFrame } = require('electron')
 
 webFrame.setZoomFactor(2)
 ```
@@ -73,7 +73,7 @@ whether the word passed is correctly spelled.
 An example of using [node-spellchecker][spellchecker] as provider:
 
 ```javascript
-const {webFrame} = require('electron')
+const { webFrame } = require('electron')
 webFrame.setSpellCheckProvider('en-US', true, {
   spellCheck (text) {
     return !(require('spellchecker').isMisspelled(text))
@@ -105,7 +105,7 @@ Specify an option with the value of `false` to omit it from the registration.
 An example of registering a privileged scheme, without bypassing Content Security Policy:
 
 ```javascript
-const {webFrame} = require('electron')
+const { webFrame } = require('electron')
 webFrame.registerURLSchemeAsPrivileged('foo', { bypassCSP: false })
 ```
 
@@ -177,7 +177,7 @@ Returns an object describing usage information of Blink's internal memory
 caches.
 
 ```javascript
-const {webFrame} = require('electron')
+const { webFrame } = require('electron')
 console.log(webFrame.getResourceUsage())
 ```
 

+ 2 - 2
docs/api/web-request.md

@@ -23,7 +23,7 @@ called with a `response` object when `listener` has done its work.
 An example of adding `User-Agent` header for requests:
 
 ```javascript
-const {session} = require('electron')
+const { session } = require('electron')
 
 // Modify the user agent for all requests to the following urls.
 const filter = {
@@ -32,7 +32,7 @@ const filter = {
 
 session.defaultSession.webRequest.onBeforeSendHeaders(filter, (details, callback) => {
   details.requestHeaders['User-Agent'] = 'MyAgent'
-  callback({cancel: false, requestHeaders: details.requestHeaders})
+  callback({ cancel: false, requestHeaders: details.requestHeaders })
 })
 ```
 

+ 2 - 2
docs/api/webview-tag.md

@@ -752,7 +752,7 @@ Fired when the guest page attempts to open a new browser window.
 The following example code opens the new url in system's default browser.
 
 ```javascript
-const {shell} = require('electron')
+const { shell } = require('electron')
 const webview = document.querySelector('webview')
 
 webview.addEventListener('new-window', (e) => {
@@ -844,7 +844,7 @@ webview.send('ping')
 
 ```javascript
 // In guest page.
-const {ipcRenderer} = require('electron')
+const { ipcRenderer } = require('electron')
 ipcRenderer.on('ping', () => {
   ipcRenderer.sendToHost('pong')
 })

+ 1 - 1
docs/development/upgrading-chromium.md

@@ -144,7 +144,7 @@ codecs.
     <video style="display:none" src="http://www.quirksmode.org/html5/videos/big_buck_bunny.mp4" autoplay></video>
     <script>
       const video = document.querySelector('video')
-      video.addEventListener('error', ({target}) => {
+      video.addEventListener('error', ({ target }) => {
         if (target.error.code === target.error.MEDIA_ERR_SRC_NOT_SUPPORTED) {
           document.querySelector('#outcome').textContent = 'Not using proprietary codecs, video emitted source not supported error event.'
         } else {

+ 3 - 3
docs/faq.md

@@ -78,7 +78,7 @@ If you want a quick fix, you can make the variables global by changing your
 code from this:
 
 ```javascript
-const {app, Tray} = require('electron')
+const { app, Tray } = require('electron')
 app.on('ready', () => {
   const tray = new Tray('/path/to/icon.png')
   tray.setTitle('hello world')
@@ -88,7 +88,7 @@ app.on('ready', () => {
 to this:
 
 ```javascript
-const {app, Tray} = require('electron')
+const { app, Tray } = require('electron')
 let tray = null
 app.on('ready', () => {
   tray = new Tray('/path/to/icon.png')
@@ -106,7 +106,7 @@ To solve this, you can turn off node integration in Electron:
 
 ```javascript
 // In the main process.
-const {BrowserWindow} = require('electron')
+const { BrowserWindow } = require('electron')
 let win = new BrowserWindow({
   webPreferences: {
     nodeIntegration: false

+ 10 - 10
docs/tutorial/automated-testing-with-a-custom-driver.md

@@ -11,7 +11,7 @@ var electronPath = require('electron')
 // spawn the process
 var env = { /* ... */ }
 var stdio = ['inherit', 'inherit', 'inherit', 'ipc']
-var appProcess = childProcess.spawn(electronPath, ['./app'], {stdio, env})
+var appProcess = childProcess.spawn(electronPath, ['./app'], { stdio, env })
 
 // listen for IPC messages from the app
 appProcess.on('message', (msg) => {
@@ -19,7 +19,7 @@ appProcess.on('message', (msg) => {
 })
 
 // send an IPC message to the app
-appProcess.send({my: 'message'})
+appProcess.send({ my: 'message' })
 ```
 
 From within the Electron app, you can listen for messages and send replies using the nodejs [process](https://nodejs.org/api/process.html) API:
@@ -31,7 +31,7 @@ process.on('message', (msg) => {
 })
 
 // send an IPC message to the test suite
-process.send({my: 'message'})
+process.send({ my: 'message' })
 ```
 
 We can now communicate from the test suite to the Electron app using the `appProcess` object.
@@ -40,12 +40,12 @@ For convenience, you may want to wrap `appProcess` in a driver object that provi
 
 ```js
 class TestDriver {
-  constructor ({path, args, env}) {
+  constructor ({ path, args, env }) {
     this.rpcCalls = []
 
     // start child process
     env.APP_TEST_DRIVER = 1 // let the app know it should listen for messages
-    this.process = childProcess.spawn(path, args, {stdio: ['inherit', 'inherit', 'inherit', 'ipc'], env})
+    this.process = childProcess.spawn(path, args, { stdio: ['inherit', 'inherit', 'inherit', 'ipc'], env })
 
     // handle rpc responses
     this.process.on('message', (message) => {
@@ -71,8 +71,8 @@ class TestDriver {
   async rpc (cmd, ...args) {
     // send rpc request
     var msgId = this.rpcCalls.length
-    this.process.send({msgId, cmd, args})
-    return new Promise((resolve, reject) => this.rpcCalls.push({resolve, reject}))
+    this.process.send({ msgId, cmd, args })
+    return new Promise((resolve, reject) => this.rpcCalls.push({ resolve, reject }))
   }
 
   stop () {
@@ -88,19 +88,19 @@ if (process.env.APP_TEST_DRIVER) {
   process.on('message', onMessage)
 }
 
-async function onMessage ({msgId, cmd, args}) {
+async function onMessage ({ msgId, cmd, args }) {
   var method = METHODS[cmd]
   if (!method) method = () => new Error('Invalid method: ' + cmd)
   try {
     var resolve = await method(...args)
-    process.send({msgId, resolve})
+    process.send({ msgId, resolve })
   } catch (err) {
     var reject = {
       message: err.message,
       stack: err.stack,
       name: err.name
     }
-    process.send({msgId, reject})
+    process.send({ msgId, reject })
   }
 }
 

+ 4 - 4
docs/tutorial/first-app.md

@@ -105,11 +105,11 @@ using the `electron.BrowserWindow` class. A simple `main.js` file might wait
 for the application to be ready and open a window:
 
 ```javascript
-const {app, BrowserWindow} = require('electron')
+const { app, BrowserWindow } = require('electron')
 
 function createWindow () {
   // Create the browser window.
-  win = new BrowserWindow({width: 800, height: 600})
+  win = new BrowserWindow({ width: 800, height: 600 })
 
   // and load the index.html of the app.
   win.loadFile('index.html')
@@ -124,7 +124,7 @@ might open developer tools, handle the window being closed, or re-create
 windows on macOS if the user clicks on the app's icon in the dock.
 
 ```javascript
-const {app, BrowserWindow} = require('electron')
+const { app, BrowserWindow } = require('electron')
 
 // Keep a global reference of the window object, if you don't, the window will
 // be closed automatically when the JavaScript object is garbage collected.
@@ -132,7 +132,7 @@ let win
 
 function createWindow () {
   // Create the browser window.
-  win = new BrowserWindow({width: 800, height: 600})
+  win = new BrowserWindow({ width: 800, height: 600 })
 
   // and load the index.html of the app.
   win.loadFile('index.html')

+ 2 - 2
docs/tutorial/keyboard-shortcuts.md

@@ -9,7 +9,7 @@ be triggered only when the app is focused. To do so, specify an
 [`accelerator`] property when creating a [MenuItem].
 
 ```js
-const {Menu, MenuItem} = require('electron')
+const { Menu, MenuItem } = require('electron')
 const menu = new Menu()
 
 menu.append(new MenuItem({
@@ -33,7 +33,7 @@ You can use the [globalShortcut] module to detect keyboard events even when
 the application does not have keyboard focus.
 
 ```js
-const {app, globalShortcut} = require('electron')
+const { app, globalShortcut } = require('electron')
 
 app.on('ready', () => {
   globalShortcut.register('CommandOrControl+X', () => {

+ 3 - 3
docs/tutorial/online-offline-events.md

@@ -11,7 +11,7 @@ Example:
 _main.js_
 
 ```javascript
-const {app, BrowserWindow} = require('electron')
+const { app, BrowserWindow } = require('electron')
 
 let onlineStatusWindow
 
@@ -50,7 +50,7 @@ to the main process and handled as needed, as shown in the following example.
 _main.js_
 
 ```javascript
-const {app, BrowserWindow, ipcMain} = require('electron')
+const { app, BrowserWindow, ipcMain } = require('electron')
 let onlineStatusWindow
 
 app.on('ready', () => {
@@ -70,7 +70,7 @@ _online-status.html_
 <html>
 <body>
 <script>
-  const {ipcRenderer} = require('electron')
+  const { ipcRenderer } = require('electron')
   const updateOnlineStatus = () => {
     ipcRenderer.send('online-status-changed', navigator.onLine ? 'online' : 'offline')
   }

+ 2 - 2
docs/tutorial/security.md

@@ -361,10 +361,10 @@ which can be set using Electron's
 handler:
 
 ```javascript
-const {session} = require('electron')
+const { session } = require('electron')
 
 session.defaultSession.webRequest.onHeadersReceived((details, callback) => {
-  callback({responseHeaders: `default-src 'none'`})
+  callback({ responseHeaders: `default-src 'none'` })
 })
 ```
 

+ 1 - 1
docs/tutorial/testing-widevine-cdm.md

@@ -34,7 +34,7 @@ passed before the `ready` event of `app` module gets emitted.
 Example code:
 
 ```javascript
-const {app, BrowserWindow} = require('electron')
+const { app, BrowserWindow } = require('electron')
 
 // You have to pass the directory that contains widevine library here, it is
 // * `libwidevinecdm.dylib` on macOS,

+ 1 - 1
docs/tutorial/using-pepper-flash-plugin.md

@@ -20,7 +20,7 @@ before the app ready event. Also, turn on `plugins` option of `BrowserWindow`.
 For example:
 
 ```javascript
-const {app, BrowserWindow} = require('electron')
+const { app, BrowserWindow } = require('electron')
 const path = require('path')
 
 // Specify flash path, supposing it is placed in the same directory with main.js.

+ 4 - 4
docs/tutorial/using-selenium-and-webdriver.md

@@ -32,13 +32,13 @@ app.start().then(function () {
   return app.browserWindow.isVisible()
 }).then(function (isVisible) {
   // Verify the window is visible
-  assert.equal(isVisible, true)
+  assert.strictEqual(isVisible, true)
 }).then(function () {
   // Get the window's title
   return app.client.getTitle()
 }).then(function (title) {
   // Verify the window's title
-  assert.equal(title, 'My App')
+  assert.strictEqual(title, 'My App')
 }).catch(function (error) {
   // Log any failures
   console.error('Test failed', error.message)
@@ -135,12 +135,12 @@ $ npm install webdriverio
 const webdriverio = require('webdriverio')
 const options = {
   host: 'localhost', // Use localhost as chrome driver server
-  port: 9515,        // "9515" is the port opened by chrome driver.
+  port: 9515, // "9515" is the port opened by chrome driver.
   desiredCapabilities: {
     browserName: 'chrome',
     chromeOptions: {
       binary: '/Path-to-Your-App/electron', // Path to your Electron binary.
-      args: [/* cli arguments */]           // Optional, perhaps 'app=' + /path/to/your/app/
+      args: [/* cli arguments */] // Optional, perhaps 'app=' + /path/to/your/app/
     }
   }
 }

+ 2 - 2
docs/tutorial/windows-taskbar.md

@@ -148,7 +148,7 @@ To set the overlay icon for a window, you can use the
 [BrowserWindow.setOverlayIcon][setoverlayicon] API:
 
 ```javascript
-const {BrowserWindow} = require('electron')
+const { BrowserWindow } = require('electron')
 let win = new BrowserWindow()
 win.setOverlayIcon('path/to/overlay.png', 'Description for overlay')
 ```
@@ -167,7 +167,7 @@ To flash the BrowserWindow taskbar button, you can use the
 [BrowserWindow.flashFrame][flashframe] API:
 
 ```javascript
-const {BrowserWindow} = require('electron')
+const { BrowserWindow } = require('electron')
 let win = new BrowserWindow()
 win.once('focus', () => win.flashFrame(false))
 win.flashFrame(true)

+ 4 - 4
lib/browser/api/app.js

@@ -2,14 +2,14 @@
 
 const bindings = process.atomBinding('app')
 const path = require('path')
-const {app, App} = bindings
+const { app, App } = bindings
 
 // Only one app object permitted.
 module.exports = app
 
 const electron = require('electron')
-const {deprecate, Menu} = electron
-const {EventEmitter} = require('events')
+const { deprecate, Menu } = electron
+const { EventEmitter } = require('events')
 
 let dockMenu = null
 
@@ -113,5 +113,5 @@ for (let name of events) {
 }
 
 // Wrappers for native classes.
-const {DownloadItem} = process.atomBinding('download_item')
+const { DownloadItem } = process.atomBinding('download_item')
 Object.setPrototypeOf(DownloadItem.prototype, EventEmitter.prototype)

+ 1 - 1
lib/browser/api/auto-updater/auto-updater-native.js

@@ -1,5 +1,5 @@
 const EventEmitter = require('events').EventEmitter
-const {autoUpdater, AutoUpdater} = process.atomBinding('auto_updater')
+const { autoUpdater, AutoUpdater } = process.atomBinding('auto_updater')
 
 // AutoUpdater is an EventEmitter.
 Object.setPrototypeOf(AutoUpdater.prototype, EventEmitter.prototype)

+ 3 - 3
lib/browser/api/auto-updater/auto-updater-win.js

@@ -1,7 +1,7 @@
 'use strict'
 
-const {app} = require('electron')
-const {EventEmitter} = require('events')
+const { app } = require('electron')
+const { EventEmitter } = require('events')
 const squirrelUpdate = require('./squirrel-update-win')
 
 class AutoUpdater extends EventEmitter {
@@ -54,7 +54,7 @@ class AutoUpdater extends EventEmitter {
         if (error != null) {
           return this.emitError(error)
         }
-        const {releaseNotes, version} = update
+        const { releaseNotes, version } = update
         // Date is not available on Windows, so fake it.
         const date = new Date()
         this.emit('update-downloaded', {}, releaseNotes, version, date, this.updateURL, () => {

+ 2 - 2
lib/browser/api/box-layout.js

@@ -2,8 +2,8 @@
 
 const electron = require('electron')
 
-const {LayoutManager} = electron
-const {BoxLayout} = process.atomBinding('box_layout')
+const { LayoutManager } = electron
+const { BoxLayout } = process.atomBinding('box_layout')
 
 Object.setPrototypeOf(BoxLayout.prototype, LayoutManager.prototype)
 

+ 2 - 2
lib/browser/api/browser-view.js

@@ -1,7 +1,7 @@
 'use strict'
 
-const {EventEmitter} = require('events')
-const {BrowserView} = process.atomBinding('browser_view')
+const { EventEmitter } = require('events')
+const { BrowserView } = process.atomBinding('browser_view')
 
 Object.setPrototypeOf(BrowserView.prototype, EventEmitter.prototype)
 

+ 14 - 14
lib/browser/api/browser-window.js

@@ -1,8 +1,8 @@
 'use strict'
 
 const electron = require('electron')
-const {ipcMain, WebContentsView, TopLevelWindow} = electron
-const {BrowserWindow} = process.atomBinding('window')
+const { ipcMain, WebContentsView, TopLevelWindow } = electron
+const { BrowserWindow } = process.atomBinding('window')
 const v8Util = process.atomBinding('v8_util')
 
 Object.setPrototypeOf(BrowserWindow.prototype, TopLevelWindow.prototype)
@@ -12,35 +12,35 @@ BrowserWindow.prototype._init = function () {
   TopLevelWindow.prototype._init.call(this)
 
   // Avoid recursive require.
-  const {app} = electron
+  const { app } = electron
 
   // Create WebContentsView.
   this.setContentView(new WebContentsView(this.webContents))
 
   // Make new windows requested by links behave like "window.open"
   this.webContents.on('-new-window', (event, url, frameName, disposition,
-                                      additionalFeatures, postData,
-                                      referrer) => {
+    additionalFeatures, postData,
+    referrer) => {
     const options = {
       show: true,
       width: 800,
       height: 600
     }
     ipcMain.emit('ELECTRON_GUEST_WINDOW_MANAGER_INTERNAL_WINDOW_OPEN',
-                 event, url, referrer, frameName, disposition,
-                 options, additionalFeatures, postData)
+      event, url, referrer, frameName, disposition,
+      options, additionalFeatures, postData)
   })
 
   this.webContents.on('-web-contents-created', (event, webContents, url,
-                                                frameName) => {
-    v8Util.setHiddenValue(webContents, 'url-framename', {url, frameName})
+    frameName) => {
+    v8Util.setHiddenValue(webContents, 'url-framename', { url, frameName })
   })
 
   // Create a new browser window for the native implementation of
   // "window.open", used in sandbox and nativeWindowOpen mode
   this.webContents.on('-add-new-contents', (event, webContents, disposition,
-                                            userGesture, left, top, width,
-                                            height) => {
+    userGesture, left, top, width,
+    height) => {
     let urlFrameName = v8Util.getHiddenValue(webContents, 'url-framename')
     if ((disposition !== 'foreground-tab' && disposition !== 'new-window' &&
          disposition !== 'background-tab') || !urlFrameName) {
@@ -48,7 +48,7 @@ BrowserWindow.prototype._init = function () {
       return
     }
 
-    let {url, frameName} = urlFrameName
+    let { url, frameName } = urlFrameName
     v8Util.deleteHiddenValue(webContents, 'url-framename')
     const options = {
       show: true,
@@ -60,7 +60,7 @@ BrowserWindow.prototype._init = function () {
     }
     const referrer = { url: '', policy: 'default' }
     ipcMain.emit('ELECTRON_GUEST_WINDOW_MANAGER_INTERNAL_WINDOW_OPEN',
-                 event, url, referrer, frameName, disposition, options)
+      event, url, referrer, frameName, disposition, options)
   })
 
   // window.resizeTo(...)
@@ -167,7 +167,7 @@ BrowserWindow.fromBrowserView = (browserView) => {
 
 BrowserWindow.fromDevToolsWebContents = (webContents) => {
   for (const window of BrowserWindow.getAllWindows()) {
-    const {devToolsWebContents} = window
+    const { devToolsWebContents } = window
     if (devToolsWebContents != null && devToolsWebContents.equal(webContents)) {
       return window
     }

+ 2 - 2
lib/browser/api/button.js

@@ -2,8 +2,8 @@
 
 const electron = require('electron')
 
-const {View} = electron
-const {Button} = process.atomBinding('button')
+const { View } = electron
+const { Button } = process.atomBinding('button')
 
 Object.setPrototypeOf(Button.prototype, View.prototype)
 

+ 8 - 8
lib/browser/api/dialog.js

@@ -1,6 +1,6 @@
 'use strict'
 
-const {app, BrowserWindow} = require('electron')
+const { app, BrowserWindow } = require('electron')
 const binding = process.atomBinding('dialog')
 const v8Util = process.atomBinding('v8_util')
 
@@ -83,7 +83,7 @@ module.exports = {
       }
     }
 
-    let {buttonLabel, defaultPath, filters, properties, title, message, securityScopedBookmarks = false} = options
+    let { buttonLabel, defaultPath, filters, properties, title, message, securityScopedBookmarks = false } = options
 
     if (properties == null) {
       properties = ['openFile']
@@ -129,7 +129,7 @@ module.exports = {
     const wrappedCallback = typeof callback === 'function' ? function (success, result, bookmarkData) {
       return success ? callback(result, bookmarkData) : callback()
     } : null
-    const settings = {title, buttonLabel, defaultPath, filters, message, securityScopedBookmarks, window}
+    const settings = { title, buttonLabel, defaultPath, filters, message, securityScopedBookmarks, window }
     settings.properties = dialogProperties
     return binding.showOpenDialog(settings, wrappedCallback)
   },
@@ -145,7 +145,7 @@ module.exports = {
       }
     }
 
-    let {buttonLabel, defaultPath, filters, title, message, securityScopedBookmarks = false, nameFieldLabel, showsTagField} = options
+    let { buttonLabel, defaultPath, filters, title, message, securityScopedBookmarks = false, nameFieldLabel, showsTagField } = options
 
     if (title == null) {
       title = ''
@@ -188,7 +188,7 @@ module.exports = {
     const wrappedCallback = typeof callback === 'function' ? function (success, result, bookmarkData) {
       return success ? callback(result, bookmarkData) : callback()
     } : null
-    const settings = {title, buttonLabel, defaultPath, filters, message, securityScopedBookmarks, nameFieldLabel, showsTagField, window}
+    const settings = { title, buttonLabel, defaultPath, filters, message, securityScopedBookmarks, nameFieldLabel, showsTagField, window }
     return binding.showSaveDialog(settings, wrappedCallback)
   },
 
@@ -275,8 +275,8 @@ module.exports = {
 
     const flags = options.noLink ? messageBoxOptions.noLink : 0
     return binding.showMessageBox(messageBoxType, buttons, defaultId, cancelId,
-                                  flags, title, message, detail, checkboxLabel,
-                                  checkboxChecked, icon, window, callback)
+      flags, title, message, detail, checkboxLabel,
+      checkboxChecked, icon, window, callback)
   },
 
   showErrorBox: function (...args) {
@@ -290,7 +290,7 @@ module.exports = {
       throw new TypeError('options must be an object')
     }
 
-    let {certificate, message} = options
+    let { certificate, message } = options
     if (certificate == null || typeof certificate !== 'object') {
       throw new TypeError('certificate must be an object')
     }

+ 2 - 2
lib/browser/api/in-app-purchase.js

@@ -1,8 +1,8 @@
 'use strict'
 
 if (process.platform === 'darwin') {
-  const {EventEmitter} = require('events')
-  const {inAppPurchase, InAppPurchase} = process.atomBinding('in_app_purchase')
+  const { EventEmitter } = require('events')
+  const { inAppPurchase, InAppPurchase } = process.atomBinding('in_app_purchase')
 
   // inAppPurchase is an EventEmitter.
   Object.setPrototypeOf(InAppPurchase.prototype, EventEmitter.prototype)

+ 2 - 2
lib/browser/api/label-button.js

@@ -2,8 +2,8 @@
 
 const electron = require('electron')
 
-const {Button} = electron
-const {LabelButton} = process.atomBinding('label_button')
+const { Button } = electron
+const { LabelButton } = process.atomBinding('label_button')
 
 Object.setPrototypeOf(LabelButton.prototype, Button.prototype)
 

+ 1 - 1
lib/browser/api/layout-manager.js

@@ -1,6 +1,6 @@
 'use strict'
 
-const {LayoutManager} = process.atomBinding('layout_manager')
+const { LayoutManager } = process.atomBinding('layout_manager')
 
 LayoutManager.prototype._init = function () {
 }

+ 3 - 3
lib/browser/api/menu-item-roles.js

@@ -1,4 +1,4 @@
-const {app} = require('electron')
+const { app } = require('electron')
 
 const roles = {
   about: {
@@ -244,7 +244,7 @@ exports.getDefaultAccelerator = (role) => {
 exports.getDefaultSubmenu = (role) => {
   if (!roles.hasOwnProperty(role)) return
 
-  let {submenu} = roles[role]
+  let { submenu } = roles[role]
 
   // remove null items from within the submenu
   if (Array.isArray(submenu)) {
@@ -257,7 +257,7 @@ exports.getDefaultSubmenu = (role) => {
 exports.execute = (role, focusedWindow, focusedWebContents) => {
   if (!canExecuteRole(role)) return false
 
-  const {appMethod, webContentsMethod, windowMethod} = roles[role]
+  const { appMethod, webContentsMethod, windowMethod } = roles[role]
 
   if (appMethod) {
     app[appMethod]()

+ 1 - 1
lib/browser/api/menu-item.js

@@ -5,7 +5,7 @@ const roles = require('./menu-item-roles')
 let nextCommandId = 0
 
 const MenuItem = function (options) {
-  const {Menu} = require('electron')
+  const { Menu } = require('electron')
 
   // Preserve extra fields specified by user
   for (let key in options) {

+ 1 - 1
lib/browser/api/menu-utils.js

@@ -165,4 +165,4 @@ function sortMenuItems (menuItems) {
   return joined
 }
 
-module.exports = {sortMenuItems}
+module.exports = { sortMenuItems }

+ 5 - 5
lib/browser/api/menu.js

@@ -1,12 +1,12 @@
 'use strict'
 
-const {TopLevelWindow, MenuItem, webContents} = require('electron')
-const {sortMenuItems} = require('./menu-utils')
+const { TopLevelWindow, MenuItem, webContents } = require('electron')
+const { sortMenuItems } = require('./menu-utils')
 const EventEmitter = require('events').EventEmitter
 const v8Util = process.atomBinding('v8_util')
 const bindings = process.atomBinding('menu')
 
-const {Menu} = bindings
+const { Menu } = bindings
 let applicationMenu = null
 let groupIdIndex = 0
 
@@ -51,7 +51,7 @@ Menu.prototype.popup = function (options = {}) {
   if (options == null || typeof options !== 'object') {
     throw new TypeError('Options must be an object')
   }
-  let {window, x, y, positioningItem, callback} = options
+  let { window, x, y, positioningItem, callback } = options
 
   // no callback passed
   if (!callback || typeof callback !== 'function') callback = () => {}
@@ -175,7 +175,7 @@ Menu.buildFromTemplate = function (template) {
 // validate the template against having the wrong attribute
 function areValidTemplateItems (template) {
   return template.every(item =>
-  item != null && typeof item === 'object' && (item.hasOwnProperty('label') || item.hasOwnProperty('role') || item.type === 'separator'))
+    item != null && typeof item === 'object' && (item.hasOwnProperty('label') || item.hasOwnProperty('role') || item.type === 'separator'))
 }
 
 function sortTemplate (template) {

+ 32 - 32
lib/browser/api/module-list.js

@@ -2,42 +2,42 @@ const features = process.atomBinding('features')
 
 // Browser side modules, please sort alphabetically.
 module.exports = [
-  {name: 'app', file: 'app'},
-  {name: 'autoUpdater', file: 'auto-updater'},
-  {name: 'BrowserView', file: 'browser-view'},
-  {name: 'BrowserWindow', file: 'browser-window'},
-  {name: 'contentTracing', file: 'content-tracing'},
-  {name: 'dialog', file: 'dialog'},
-  {name: 'globalShortcut', file: 'global-shortcut'},
-  {name: 'ipcMain', file: 'ipc-main'},
-  {name: 'inAppPurchase', file: 'in-app-purchase'},
-  {name: 'Menu', file: 'menu'},
-  {name: 'MenuItem', file: 'menu-item'},
-  {name: 'net', file: 'net'},
-  {name: 'netLog', file: 'net-log'},
-  {name: 'Notification', file: 'notification'},
-  {name: 'powerMonitor', file: 'power-monitor'},
-  {name: 'powerSaveBlocker', file: 'power-save-blocker'},
-  {name: 'protocol', file: 'protocol'},
-  {name: 'screen', file: 'screen'},
-  {name: 'session', file: 'session'},
-  {name: 'systemPreferences', file: 'system-preferences'},
-  {name: 'TopLevelWindow', file: 'top-level-window'},
-  {name: 'TouchBar', file: 'touch-bar'},
-  {name: 'Tray', file: 'tray'},
-  {name: 'View', file: 'view'},
-  {name: 'webContents', file: 'web-contents'},
-  {name: 'WebContentsView', file: 'web-contents-view'},
+  { name: 'app', file: 'app' },
+  { name: 'autoUpdater', file: 'auto-updater' },
+  { name: 'BrowserView', file: 'browser-view' },
+  { name: 'BrowserWindow', file: 'browser-window' },
+  { name: 'contentTracing', file: 'content-tracing' },
+  { name: 'dialog', file: 'dialog' },
+  { name: 'globalShortcut', file: 'global-shortcut' },
+  { name: 'ipcMain', file: 'ipc-main' },
+  { name: 'inAppPurchase', file: 'in-app-purchase' },
+  { name: 'Menu', file: 'menu' },
+  { name: 'MenuItem', file: 'menu-item' },
+  { name: 'net', file: 'net' },
+  { name: 'netLog', file: 'net-log' },
+  { name: 'Notification', file: 'notification' },
+  { name: 'powerMonitor', file: 'power-monitor' },
+  { name: 'powerSaveBlocker', file: 'power-save-blocker' },
+  { name: 'protocol', file: 'protocol' },
+  { name: 'screen', file: 'screen' },
+  { name: 'session', file: 'session' },
+  { name: 'systemPreferences', file: 'system-preferences' },
+  { name: 'TopLevelWindow', file: 'top-level-window' },
+  { name: 'TouchBar', file: 'touch-bar' },
+  { name: 'Tray', file: 'tray' },
+  { name: 'View', file: 'view' },
+  { name: 'webContents', file: 'web-contents' },
+  { name: 'WebContentsView', file: 'web-contents-view' },
   // The internal modules, invisible unless you know their names.
-  {name: 'NavigationController', file: 'navigation-controller', private: true}
+  { name: 'NavigationController', file: 'navigation-controller', private: true }
 ]
 
 if (features.isViewApiEnabled()) {
   module.exports.push(
-    {name: 'BoxLayout', file: 'box-layout'},
-    {name: 'Button', file: 'button'},
-    {name: 'LabelButton', file: 'label-button'},
-    {name: 'LayoutManager', file: 'layout-manager'},
-    {name: 'TextField', file: 'text-field'}
+    { name: 'BoxLayout', file: 'box-layout' },
+    { name: 'Button', file: 'button' },
+    { name: 'LabelButton', file: 'label-button' },
+    { name: 'LayoutManager', file: 'layout-manager' },
+    { name: 'TextField', file: 'text-field' }
   )
 }

+ 1 - 1
lib/browser/api/navigation-controller.js

@@ -1,6 +1,6 @@
 'use strict'
 
-const {ipcMain} = require('electron')
+const { ipcMain } = require('electron')
 
 // The history operation in renderer is redirected to browser.
 ipcMain.on('ELECTRON_NAVIGATION_CONTROLLER', function (event, method, ...args) {

+ 1 - 1
lib/browser/api/net-log.js

@@ -1,6 +1,6 @@
 'use strict'
 
-const {netLog, NetLog} = process.atomBinding('net_log')
+const { netLog, NetLog } = process.atomBinding('net_log')
 
 NetLog.prototype.stopLogging = function (callback) {
   if (callback && typeof callback !== 'function') {

+ 6 - 6
lib/browser/api/net.js

@@ -1,12 +1,12 @@
 'use strict'
 
 const url = require('url')
-const {EventEmitter} = require('events')
-const {Readable} = require('stream')
-const {app} = require('electron')
-const {Session} = process.atomBinding('session')
-const {net, Net} = process.atomBinding('net')
-const {URLRequest} = net
+const { EventEmitter } = require('events')
+const { Readable } = require('stream')
+const { app } = require('electron')
+const { Session } = process.atomBinding('session')
+const { net, Net } = process.atomBinding('net')
+const { URLRequest } = net
 
 // Net is an EventEmitter.
 Object.setPrototypeOf(Net.prototype, EventEmitter.prototype)

+ 2 - 2
lib/browser/api/notification.js

@@ -1,5 +1,5 @@
-const {EventEmitter} = require('events')
-const {Notification, isSupported} = process.atomBinding('notification')
+const { EventEmitter } = require('events')
+const { Notification, isSupported } = process.atomBinding('notification')
 
 Object.setPrototypeOf(Notification.prototype, EventEmitter.prototype)
 

+ 2 - 2
lib/browser/api/power-monitor.js

@@ -1,5 +1,5 @@
-const {EventEmitter} = require('events')
-const {powerMonitor, PowerMonitor} = process.atomBinding('power_monitor')
+const { EventEmitter } = require('events')
+const { powerMonitor, PowerMonitor } = process.atomBinding('power_monitor')
 
 // PowerMonitor is an EventEmitter.
 Object.setPrototypeOf(PowerMonitor.prototype, EventEmitter.prototype)

+ 1 - 1
lib/browser/api/protocol.js

@@ -1,4 +1,4 @@
-const {app, session} = require('electron')
+const { app, session } = require('electron')
 
 // Global protocol APIs.
 module.exports = process.atomBinding('protocol')

+ 2 - 2
lib/browser/api/screen.js

@@ -1,5 +1,5 @@
-const {EventEmitter} = require('events')
-const {screen, Screen} = process.atomBinding('screen')
+const { EventEmitter } = require('events')
+const { screen, Screen } = process.atomBinding('screen')
 
 // Screen is an EventEmitter.
 Object.setPrototypeOf(Screen.prototype, EventEmitter.prototype)

+ 3 - 3
lib/browser/api/session.js

@@ -1,6 +1,6 @@
-const {EventEmitter} = require('events')
-const {app} = require('electron')
-const {fromPartition, Session, Cookies} = process.atomBinding('session')
+const { EventEmitter } = require('events')
+const { app } = require('electron')
+const { fromPartition, Session, Cookies } = process.atomBinding('session')
 
 // Public API.
 Object.defineProperties(exports, {

+ 2 - 2
lib/browser/api/system-preferences.js

@@ -1,5 +1,5 @@
-const {EventEmitter} = require('events')
-const {systemPreferences, SystemPreferences} = process.atomBinding('system_preferences')
+const { EventEmitter } = require('events')
+const { systemPreferences, SystemPreferences } = process.atomBinding('system_preferences')
 
 // SystemPreferences is an EventEmitter.
 Object.setPrototypeOf(SystemPreferences.prototype, EventEmitter.prototype)

+ 2 - 2
lib/browser/api/text-field.js

@@ -2,8 +2,8 @@
 
 const electron = require('electron')
 
-const {View} = electron
-const {TextField} = process.atomBinding('text_field')
+const { View } = electron
+const { TextField } = process.atomBinding('text_field')
 
 Object.setPrototypeOf(TextField.prototype, View.prototype)
 

+ 3 - 3
lib/browser/api/top-level-window.js

@@ -1,14 +1,14 @@
 'use strict'
 
 const electron = require('electron')
-const {EventEmitter} = require('events')
-const {TopLevelWindow} = process.atomBinding('top_level_window')
+const { EventEmitter } = require('events')
+const { TopLevelWindow } = process.atomBinding('top_level_window')
 
 Object.setPrototypeOf(TopLevelWindow.prototype, EventEmitter.prototype)
 
 TopLevelWindow.prototype._init = function () {
   // Avoid recursive require.
-  const {app} = electron
+  const { app } = electron
 
   // Simulate the application menu on platforms other than macOS.
   if (process.platform !== 'darwin') {

+ 9 - 9
lib/browser/api/touch-bar.js

@@ -1,4 +1,4 @@
-const {EventEmitter} = require('events')
+const { EventEmitter } = require('events')
 
 let nextItemID = 1
 
@@ -27,7 +27,7 @@ class TouchBar extends EventEmitter {
       throw new Error('Must specify options object as first argument')
     }
 
-    let {items, escapeItem} = options
+    let { items, escapeItem } = options
 
     // FIXME Support array as first argument, remove in 2.0
     if (Array.isArray(options)) {
@@ -83,7 +83,7 @@ class TouchBar extends EventEmitter {
   }
 
   _addToWindow (window) {
-    const {id} = window
+    const { id } = window
 
     // Already added to window
     if (this.windowListeners.hasOwnProperty(id)) return
@@ -195,7 +195,7 @@ TouchBar.TouchBarButton = class TouchBarButton extends TouchBarItem {
     super()
     if (config == null) config = {}
     this._addImmutableProperty('type', 'button')
-    const {click, icon, iconPosition, label, backgroundColor} = config
+    const { click, icon, iconPosition, label, backgroundColor } = config
     this._addLiveProperty('label', label)
     this._addLiveProperty('backgroundColor', backgroundColor)
     this._addLiveProperty('icon', icon)
@@ -213,7 +213,7 @@ TouchBar.TouchBarColorPicker = class TouchBarColorPicker extends TouchBarItem {
     super()
     if (config == null) config = {}
     this._addImmutableProperty('type', 'colorpicker')
-    const {availableColors, change, selectedColor} = config
+    const { availableColors, change, selectedColor } = config
     this._addLiveProperty('availableColors', availableColors)
     this._addLiveProperty('selectedColor', selectedColor)
 
@@ -266,7 +266,7 @@ TouchBar.TouchBarSlider = class TouchBarSlider extends TouchBarItem {
     super()
     if (config == null) config = {}
     this._addImmutableProperty('type', 'slider')
-    const {change, label, minValue, maxValue, value} = config
+    const { change, label, minValue, maxValue, value } = config
     this._addLiveProperty('label', label)
     this._addLiveProperty('minValue', minValue)
     this._addLiveProperty('maxValue', maxValue)
@@ -294,7 +294,7 @@ TouchBar.TouchBarSegmentedControl = class TouchBarSegmentedControl extends Touch
   constructor (config) {
     super()
     if (config == null) config = {}
-    const {segmentStyle, segments, selectedIndex, change, mode} = config
+    const { segmentStyle, segments, selectedIndex, change, mode } = config
     this._addImmutableProperty('type', 'segmented_control')
     this._addLiveProperty('segmentStyle', segmentStyle)
     this._addLiveProperty('segments', segments || [])
@@ -314,8 +314,8 @@ TouchBar.TouchBarScrubber = class TouchBarScrubber extends TouchBarItem {
   constructor (config) {
     super()
     if (config == null) config = {}
-    const {items, selectedStyle, overlayStyle, showArrowButtons, continuous, mode} = config
-    let {select, highlight} = config
+    const { items, selectedStyle, overlayStyle, showArrowButtons, continuous, mode } = config
+    let { select, highlight } = config
     this._addImmutableProperty('type', 'scrubber')
     this._addLiveProperty('items', items)
     this._addLiveProperty('selectedStyle', selectedStyle || null)

+ 2 - 2
lib/browser/api/tray.js

@@ -1,5 +1,5 @@
-const {EventEmitter} = require('events')
-const {Tray} = process.atomBinding('tray')
+const { EventEmitter } = require('events')
+const { Tray } = process.atomBinding('tray')
 
 Object.setPrototypeOf(Tray.prototype, EventEmitter.prototype)
 

+ 2 - 2
lib/browser/api/view.js

@@ -1,7 +1,7 @@
 'use strict'
 
-const {EventEmitter} = require('events')
-const {View} = process.atomBinding('view')
+const { EventEmitter } = require('events')
+const { View } = process.atomBinding('view')
 
 Object.setPrototypeOf(View.prototype, EventEmitter.prototype)
 

+ 2 - 2
lib/browser/api/web-contents-view.js

@@ -2,8 +2,8 @@
 
 const electron = require('electron')
 
-const {View} = electron
-const {WebContentsView} = process.atomBinding('web_contents_view')
+const { View } = electron
+const { WebContentsView } = process.atomBinding('web_contents_view')
 
 Object.setPrototypeOf(WebContentsView.prototype, View.prototype)
 

+ 5 - 5
lib/browser/api/web-contents.js

@@ -1,10 +1,10 @@
 'use strict'
 
-const {EventEmitter} = require('events')
+const { EventEmitter } = require('events')
 const electron = require('electron')
 const path = require('path')
 const url = require('url')
-const {app, ipcMain, session, NavigationController, deprecate} = electron
+const { app, ipcMain, session, NavigationController, deprecate } = electron
 
 const errorUtils = require('../../common/error-utils')
 
@@ -90,7 +90,7 @@ const defaultPrintingSetting = {
 
 // JavaScript implementations of WebContents.
 const binding = process.atomBinding('web_contents')
-const {WebContents} = binding
+const { WebContents } = binding
 
 Object.setPrototypeOf(NavigationController.prototype, EventEmitter.prototype)
 Object.setPrototypeOf(WebContents.prototype, NavigationController.prototype)
@@ -216,7 +216,7 @@ WebContents.prototype.loadFile = function (filePath, options = {}) {
   if (typeof filePath !== 'string') {
     throw new Error('Must pass filePath as a string')
   }
-  const {query, search, hash} = options
+  const { query, search, hash } = options
 
   return this.loadURL(url.format({
     protocol: 'file',
@@ -285,7 +285,7 @@ WebContents.prototype._init = function () {
 }
 
 // JavaScript wrapper of Debugger.
-const {Debugger} = process.atomBinding('debugger')
+const { Debugger } = process.atomBinding('debugger')
 
 Object.setPrototypeOf(Debugger.prototype, EventEmitter.prototype)
 

+ 8 - 8
lib/browser/chrome-extension.js

@@ -1,15 +1,15 @@
-const {app, ipcMain, webContents, BrowserWindow} = require('electron')
-const {getAllWebContents} = process.atomBinding('web_contents')
+const { app, ipcMain, webContents, BrowserWindow } = require('electron')
+const { getAllWebContents } = process.atomBinding('web_contents')
 const renderProcessPreferences = process.atomBinding('render_process_preferences').forAllWebContents()
 
-const {Buffer} = require('buffer')
+const { Buffer } = require('buffer')
 const fs = require('fs')
 const path = require('path')
 const url = require('url')
 
 // Mapping between extensionId(hostname) and manifest.
-const manifestMap = {}  // extensionId => manifest
-const manifestNameMap = {}  // name => manifest
+const manifestMap = {} // extensionId => manifest
+const manifestNameMap = {} // name => manifest
 const devToolsExtensionNames = new Set()
 
 const generateExtensionIdFromName = function (name) {
@@ -154,7 +154,7 @@ ipcMain.on('CHROME_RUNTIME_CONNECT', function (event, extensionId, connectInfo)
   }
 
   const portId = ++nextId
-  event.returnValue = {tabId: page.webContents.id, portId: portId}
+  event.returnValue = { tabId: page.webContents.id, portId: portId }
 
   event.sender.once('render-view-deleted', () => {
     if (page.webContents.isDestroyed()) return
@@ -318,7 +318,7 @@ const chromeExtensionHandler = function (request, callback) {
     if (err) {
       // Disabled due to false positive in StandardJS
       // eslint-disable-next-line standard/no-callback-literal
-      return callback(-6)  // FILE_NOT_FOUND
+      return callback(-6) // FILE_NOT_FOUND
     } else {
       return callback(content)
     }
@@ -399,7 +399,7 @@ app.once('ready', function () {
     const extensions = {}
     Object.keys(manifestNameMap).forEach(function (name) {
       const manifest = manifestNameMap[name]
-      extensions[name] = {name: manifest.name, version: manifest.version}
+      extensions[name] = { name: manifest.name, version: manifest.version }
     })
     return extensions
   }

+ 3 - 3
lib/browser/desktop-capturer.js

@@ -1,7 +1,7 @@
 'use strict'
 
-const {ipcMain} = require('electron')
-const {desktopCapturer} = process.atomBinding('desktop_capturer')
+const { ipcMain } = require('electron')
+const { desktopCapturer } = process.atomBinding('desktop_capturer')
 
 const deepEqual = (a, b) => JSON.stringify(a) === JSON.stringify(b)
 
@@ -65,7 +65,7 @@ desktopCapturer.emit = (event, name, sources) => {
 
   // If the requestsQueue is not empty, start a new request handling.
   if (requestsQueue.length > 0) {
-    const {captureWindow, captureScreen, thumbnailSize} = requestsQueue[0].options
+    const { captureWindow, captureScreen, thumbnailSize } = requestsQueue[0].options
     return desktopCapturer.startHandling(captureWindow, captureScreen, thumbnailSize)
   }
 }

+ 2 - 2
lib/browser/guest-view-manager.js

@@ -1,6 +1,6 @@
 'use strict'
 
-const {ipcMain, webContents} = require('electron')
+const { ipcMain, webContents } = require('electron')
 const parseFeaturesString = require('../common/parse-features-string')
 
 // Doesn't exist in early initialization.
@@ -191,7 +191,7 @@ const attachGuest = function (event, embedderFrameId, elementInstanceId, guestIn
   if (!guestInstance) {
     return
   }
-  const {guest} = guestInstance
+  const { guest } = guestInstance
 
   // If this guest is already attached to an element then remove it
   if (guestInstance.elementInstanceId) {

+ 7 - 7
lib/browser/guest-window-manager.js

@@ -1,7 +1,7 @@
 'use strict'
 
-const {BrowserWindow, ipcMain, webContents} = require('electron')
-const {isSameOrigin} = process.atomBinding('v8_util')
+const { BrowserWindow, ipcMain, webContents } = require('electron')
+const { isSameOrigin } = process.atomBinding('v8_util')
 const parseFeaturesString = require('../common/parse-features-string')
 
 const hasProp = {}.hasOwnProperty
@@ -52,7 +52,7 @@ const mergeBrowserWindowOptions = function (embedder, options) {
     // if parent's visibility is available, that overrides 'show' flag (#12125)
     const win = BrowserWindow.fromWebContents(embedder.webContents)
     if (win != null) {
-      parentOptions = {...embedder.browserWindowOptions, show: win.isVisible()}
+      parentOptions = { ...embedder.browserWindowOptions, show: win.isVisible() }
     }
 
     // Inherit the original options if it is a BrowserWindow.
@@ -247,16 +247,16 @@ ipcMain.on('ELECTRON_GUEST_WINDOW_MANAGER_WINDOW_OPEN', (event, url, frameName,
 
   const referrer = { url: '', policy: 'default' }
   ipcMain.emit('ELECTRON_GUEST_WINDOW_MANAGER_INTERNAL_WINDOW_OPEN', event,
-               url, referrer, frameName, disposition, options, additionalFeatures)
+    url, referrer, frameName, disposition, options, additionalFeatures)
 })
 
 // Routed window.open messages with fully parsed options
 ipcMain.on('ELECTRON_GUEST_WINDOW_MANAGER_INTERNAL_WINDOW_OPEN', function (event, url, referrer,
-                                                                  frameName, disposition, options,
-                                                                  additionalFeatures, postData) {
+  frameName, disposition, options,
+  additionalFeatures, postData) {
   options = mergeBrowserWindowOptions(event.sender, options)
   event.sender.emit('new-window', event, url, frameName, disposition, options, additionalFeatures, referrer)
-  const {newGuest} = event
+  const { newGuest } = event
   if ((event.sender.isGuest() && !event.sender.allowPopups) || event.defaultPrevented) {
     if (newGuest != null) {
       if (options.webContents === newGuest.webContents) {

+ 2 - 2
lib/browser/init.js

@@ -1,6 +1,6 @@
 'use strict'
 
-const {Buffer} = require('buffer')
+const { Buffer } = require('buffer')
 const fs = require('fs')
 const path = require('path')
 const util = require('util')
@@ -58,7 +58,7 @@ process.on('uncaughtException', function (error) {
 })
 
 // Emit 'exit' event on quit.
-const {app} = require('electron')
+const { app } = require('electron')
 
 app.on('quit', function (event, exitCode) {
   process.emit('exit', exitCode)

+ 5 - 5
lib/browser/rpc-server.js

@@ -1,11 +1,11 @@
 'use strict'
 
 const electron = require('electron')
-const {EventEmitter} = require('events')
+const { EventEmitter } = require('events')
 const fs = require('fs')
 const v8Util = process.atomBinding('v8_util')
 
-const {ipcMain, isPromise} = electron
+const { ipcMain, isPromise } = electron
 
 const objectsRegistry = require('./objects-registry')
 const bufferUtils = require('../common/buffer-utils')
@@ -34,7 +34,7 @@ const getObjectMembers = function (object) {
   // Map properties to descriptors.
   return names.map((name) => {
     let descriptor = Object.getOwnPropertyDescriptor(object, name)
-    let member = {name, enumerable: descriptor.enumerable, writable: false}
+    let member = { name, enumerable: descriptor.enumerable, writable: false }
     if (descriptor.get === undefined && typeof object[name] === 'function') {
       member.type = 'method'
     } else {
@@ -190,7 +190,7 @@ const unwrapArgs = function (sender, contextId, args) {
         let ret = {}
         Object.defineProperty(ret.constructor, 'name', { value: meta.name })
 
-        for (const {name, value} of meta.members) {
+        for (const { name, value } of meta.members) {
           ret[name] = metaToValue(value)
         }
         return ret
@@ -404,7 +404,7 @@ ipcMain.on('ELECTRON_BROWSER_SANDBOX_LOAD', function (event) {
     try {
       preloadSrc = fs.readFileSync(preloadPath).toString()
     } catch (err) {
-      preloadError = {stack: err ? err.stack : (new Error(`Failed to load "${preloadPath}"`)).stack}
+      preloadError = { stack: err ? err.stack : (new Error(`Failed to load "${preloadPath}"`)).stack }
     }
   }
   event.returnValue = {

+ 2 - 2
lib/common/api/crash-reporter.js

@@ -1,10 +1,10 @@
 'use strict'
 
-const {spawn} = require('child_process')
+const { spawn } = require('child_process')
 const os = require('os')
 const path = require('path')
 const electron = require('electron')
-const {app} = process.type === 'browser' ? electron : electron.remote
+const { app } = process.type === 'browser' ? electron : electron.remote
 const binding = process.atomBinding('crash_reporter')
 
 class CrashReporter {

+ 7 - 7
lib/common/api/module-list.js

@@ -1,11 +1,11 @@
 // Common modules, please sort alphabetically
 module.exports = [
-  {name: 'clipboard', file: 'clipboard'},
-  {name: 'crashReporter', file: 'crash-reporter'},
-  {name: 'nativeImage', file: 'native-image'},
-  {name: 'shell', file: 'shell'},
+  { name: 'clipboard', file: 'clipboard' },
+  { name: 'crashReporter', file: 'crash-reporter' },
+  { name: 'nativeImage', file: 'native-image' },
+  { name: 'shell', file: 'shell' },
   // The internal modules, invisible unless you know their names.
-  {name: 'deprecate', file: 'deprecate', private: true},
-  {name: 'deprecations', file: 'deprecations', private: true},
-  {name: 'isPromise', file: 'is-promise', private: true}
+  { name: 'deprecate', file: 'deprecate', private: true },
+  { name: 'deprecations', file: 'deprecations', private: true },
+  { name: 'isPromise', file: 'is-promise', private: true }
 ]

+ 107 - 107
lib/common/asar.js

@@ -1,7 +1,7 @@
 (function () {
   const asar = process.binding('atom_common_asar')
   const assert = require('assert')
-  const {Buffer} = require('buffer')
+  const { Buffer } = require('buffer')
   const childProcess = require('child_process')
   const path = require('path')
   const util = require('util')
@@ -48,22 +48,22 @@
   // Separate asar package's path from full path.
   const splitPath = archivePathOrBuffer => {
     // Shortcut for disabled asar.
-    if (isAsarDisabled()) return {isAsar: false}
+    if (isAsarDisabled()) return { isAsar: false }
 
     // Check for a bad argument type.
     let archivePath = archivePathOrBuffer
     if (Buffer.isBuffer(archivePathOrBuffer)) {
       archivePath = archivePathOrBuffer.toString()
     }
-    if (typeof archivePath !== 'string') return {isAsar: false}
+    if (typeof archivePath !== 'string') return { isAsar: false }
 
     if (archivePath.endsWith(ASAR_EXTENSION)) {
-      return {isAsar: true, asarPath: archivePath, filePath: ''}
+      return { isAsar: true, asarPath: archivePath, filePath: '' }
     }
 
     archivePath = path.normalize(archivePath)
     const index = archivePath.lastIndexOf(`${ASAR_EXTENSION}${path.sep}`)
-    if (index === -1) return {isAsar: false}
+    if (index === -1) return { isAsar: false }
 
     // E.g. for "//some/path/to/archive.asar/then/internal.file"...
     return {
@@ -85,7 +85,7 @@
   const msec = (date) => (date || fakeTime).getTime()
 
   const asarStatsToFsStats = function (stats) {
-    const {Stats, constants} = require('fs')
+    const { Stats, constants } = require('fs')
 
     let mode = constants.S_IROTH ^ constants.S_IRGRP ^ constants.S_IRUSR ^ constants.S_IWUSR
 
@@ -98,20 +98,20 @@
     }
 
     return new Stats(
-        1, // dev
-        mode, // mode
-        1, // nlink
-        uid,
-        gid,
-        0, // rdev
-        undefined, // blksize
-        ++nextInode, // ino
-        stats.size,
-        undefined, // blocks,
-        msec(stats.atime), // atim_msec
-        msec(stats.mtime), // mtim_msec
-        msec(stats.ctime), // ctim_msec
-        msec(stats.birthtime) // birthtim_msec
+      1, // dev
+      mode, // mode
+      1, // nlink
+      uid,
+      gid,
+      0, // rdev
+      undefined, // blksize
+      ++nextInode, // ino
+      stats.size,
+      undefined, // blocks,
+      msec(stats.atime), // atim_msec
+      msec(stats.mtime), // mtim_msec
+      msec(stats.ctime), // ctim_msec
+      msec(stats.birthtime) // birthtim_msec
     )
   }
 
@@ -122,7 +122,7 @@
     INVALID_ARCHIVE: 'INVALID_ARCHIVE'
   }
 
-  const createError = (errorType, {asarPath, filePath} = {}) => {
+  const createError = (errorType, { asarPath, filePath } = {}) => {
     let error
     switch (errorType) {
       case AsarError.NOT_FOUND:
@@ -154,14 +154,14 @@
     const old = module[name]
     module[name] = function () {
       const pathArgument = arguments[pathArgumentIndex]
-      const {isAsar, asarPath, filePath} = splitPath(pathArgument)
+      const { isAsar, asarPath, filePath } = splitPath(pathArgument)
       if (!isAsar) return old.apply(this, arguments)
 
       const archive = getOrCreateArchive(asarPath)
-      if (!archive) throw createError(AsarError.INVALID_ARCHIVE, {asarPath})
+      if (!archive) throw createError(AsarError.INVALID_ARCHIVE, { asarPath })
 
       const newPath = archive.copyFileOut(filePath)
-      if (!newPath) throw createError(AsarError.NOT_FOUND, {asarPath, filePath})
+      if (!newPath) throw createError(AsarError.NOT_FOUND, { asarPath, filePath })
 
       arguments[pathArgumentIndex] = newPath
       return old.apply(this, arguments)
@@ -173,7 +173,7 @@
     const old = module[name]
     module[name] = function () {
       const pathArgument = arguments[pathArgumentIndex]
-      const {isAsar, asarPath, filePath} = splitPath(pathArgument)
+      const { isAsar, asarPath, filePath } = splitPath(pathArgument)
       if (!isAsar) return old.apply(this, arguments)
 
       const callback = arguments[arguments.length - 1]
@@ -183,14 +183,14 @@
 
       const archive = getOrCreateArchive(asarPath)
       if (!archive) {
-        const error = createError(AsarError.INVALID_ARCHIVE, {asarPath})
+        const error = createError(AsarError.INVALID_ARCHIVE, { asarPath })
         nextTick(callback, [error])
         return
       }
 
       const newPath = archive.copyFileOut(filePath)
       if (!newPath) {
-        const error = createError(AsarError.NOT_FOUND, {asarPath, filePath})
+        const error = createError(AsarError.NOT_FOUND, { asarPath, filePath })
         nextTick(callback, [error])
         return
       }
@@ -202,17 +202,17 @@
     if (old[util.promisify.custom]) {
       module[name][util.promisify.custom] = function () {
         const pathArgument = arguments[pathArgumentIndex]
-        const {isAsar, asarPath, filePath} = splitPath(pathArgument)
+        const { isAsar, asarPath, filePath } = splitPath(pathArgument)
         if (!isAsar) return old[util.promisify.custom].apply(this, arguments)
 
         const archive = getOrCreateArchive(asarPath)
         if (!archive) {
-          return Promise.reject(createError(AsarError.INVALID_ARCHIVE, {asarPath}))
+          return Promise.reject(createError(AsarError.INVALID_ARCHIVE, { asarPath }))
         }
 
         const newPath = archive.copyFileOut(filePath)
         if (!newPath) {
-          return Promise.reject(createError(AsarError.NOT_FOUND, {asarPath, filePath}))
+          return Promise.reject(createError(AsarError.NOT_FOUND, { asarPath, filePath }))
         }
 
         arguments[pathArgumentIndex] = newPath
@@ -235,35 +235,35 @@
       fs.writeSync(logFDs[asarPath], `${offset}: ${filePath}\n`)
     }
 
-    const {lstatSync} = fs
+    const { lstatSync } = fs
     fs.lstatSync = pathArgument => {
-      const {isAsar, asarPath, filePath} = splitPath(pathArgument)
+      const { isAsar, asarPath, filePath } = splitPath(pathArgument)
       if (!isAsar) return lstatSync(pathArgument)
 
       const archive = getOrCreateArchive(asarPath)
-      if (!archive) throw createError(AsarError.INVALID_ARCHIVE, {asarPath})
+      if (!archive) throw createError(AsarError.INVALID_ARCHIVE, { asarPath })
 
       const stats = archive.stat(filePath)
-      if (!stats) throw createError(AsarError.NOT_FOUND, {asarPath, filePath})
+      if (!stats) throw createError(AsarError.NOT_FOUND, { asarPath, filePath })
 
       return asarStatsToFsStats(stats)
     }
 
-    const {lstat} = fs
+    const { lstat } = fs
     fs.lstat = (pathArgument, callback) => {
-      const {isAsar, asarPath, filePath} = splitPath(pathArgument)
+      const { isAsar, asarPath, filePath } = splitPath(pathArgument)
       if (!isAsar) return lstat(pathArgument, callback)
 
       const archive = getOrCreateArchive(asarPath)
       if (!archive) {
-        const error = createError(AsarError.INVALID_ARCHIVE, {asarPath})
+        const error = createError(AsarError.INVALID_ARCHIVE, { asarPath })
         nextTick(callback, [error])
         return
       }
 
       const stats = archive.stat(filePath)
       if (!stats) {
-        const error = createError(AsarError.NOT_FOUND, {asarPath, filePath})
+        const error = createError(AsarError.NOT_FOUND, { asarPath, filePath })
         nextTick(callback, [error])
         return
       }
@@ -272,27 +272,27 @@
       nextTick(callback, [null, fsStats])
     }
 
-    const {statSync} = fs
+    const { statSync } = fs
     fs.statSync = pathArgument => {
-      const {isAsar} = splitPath(pathArgument)
+      const { isAsar } = splitPath(pathArgument)
       if (!isAsar) return statSync(pathArgument)
 
       // Do not distinguish links for now.
       return fs.lstatSync(pathArgument)
     }
 
-    const {stat} = fs
+    const { stat } = fs
     fs.stat = (pathArgument, callback) => {
-      const {isAsar} = splitPath(pathArgument)
+      const { isAsar } = splitPath(pathArgument)
       if (!isAsar) return stat(pathArgument, callback)
 
       // Do not distinguish links for now.
       process.nextTick(() => fs.lstat(pathArgument, callback))
     }
 
-    const {statSyncNoException} = fs
+    const { statSyncNoException } = fs
     fs.statSyncNoException = pathArgument => {
-      const {isAsar, asarPath, filePath} = splitPath(pathArgument)
+      const { isAsar, asarPath, filePath } = splitPath(pathArgument)
       if (!isAsar) return statSyncNoException(pathArgument)
 
       const archive = getOrCreateArchive(asarPath)
@@ -304,44 +304,44 @@
       return asarStatsToFsStats(stats)
     }
 
-    const {realpathSync} = fs
+    const { realpathSync } = fs
     fs.realpathSync = function (pathArgument) {
-      const {isAsar, asarPath, filePath} = splitPath(pathArgument)
+      const { isAsar, asarPath, filePath } = splitPath(pathArgument)
       if (!isAsar) return realpathSync.apply(this, arguments)
 
       const archive = getOrCreateArchive(asarPath)
       if (!archive) {
-        throw createError(AsarError.INVALID_ARCHIVE, {asarPath})
+        throw createError(AsarError.INVALID_ARCHIVE, { asarPath })
       }
 
       const fileRealPath = archive.realpath(filePath)
       if (fileRealPath === false) {
-        throw createError(AsarError.NOT_FOUND, {asarPath, filePath})
+        throw createError(AsarError.NOT_FOUND, { asarPath, filePath })
       }
 
       return path.join(realpathSync(asarPath), fileRealPath)
     }
 
     fs.realpathSync.native = function (pathArgument) {
-      const {isAsar, asarPath, filePath} = splitPath(pathArgument)
+      const { isAsar, asarPath, filePath } = splitPath(pathArgument)
       if (!isAsar) return realpathSync.native.apply(this, arguments)
 
       const archive = getOrCreateArchive(asarPath)
       if (!archive) {
-        throw createError(AsarError.INVALID_ARCHIVE, {asarPath})
+        throw createError(AsarError.INVALID_ARCHIVE, { asarPath })
       }
 
       const fileRealPath = archive.realpath(filePath)
       if (fileRealPath === false) {
-        throw createError(AsarError.NOT_FOUND, {asarPath, filePath})
+        throw createError(AsarError.NOT_FOUND, { asarPath, filePath })
       }
 
       return path.join(realpathSync.native(asarPath), fileRealPath)
     }
 
-    const {realpath} = fs
+    const { realpath } = fs
     fs.realpath = function (pathArgument, cache, callback) {
-      const {isAsar, asarPath, filePath} = splitPath(pathArgument)
+      const { isAsar, asarPath, filePath } = splitPath(pathArgument)
       if (!isAsar) return realpath.apply(this, arguments)
 
       if (typeof cache === 'function') {
@@ -351,14 +351,14 @@
 
       const archive = getOrCreateArchive(asarPath)
       if (!archive) {
-        const error = createError(AsarError.INVALID_ARCHIVE, {asarPath})
+        const error = createError(AsarError.INVALID_ARCHIVE, { asarPath })
         nextTick(callback, [error])
         return
       }
 
       const fileRealPath = archive.realpath(filePath)
       if (fileRealPath === false) {
-        const error = createError(AsarError.NOT_FOUND, {asarPath, filePath})
+        const error = createError(AsarError.NOT_FOUND, { asarPath, filePath })
         nextTick(callback, [error])
         return
       }
@@ -374,7 +374,7 @@
     }
 
     fs.realpath.native = function (pathArgument, cache, callback) {
-      const {isAsar, asarPath, filePath} = splitPath(pathArgument)
+      const { isAsar, asarPath, filePath } = splitPath(pathArgument)
       if (!isAsar) return realpath.native.apply(this, arguments)
 
       if (typeof cache === 'function') {
@@ -384,14 +384,14 @@
 
       const archive = getOrCreateArchive(asarPath)
       if (!archive) {
-        const error = createError(AsarError.INVALID_ARCHIVE, {asarPath})
+        const error = createError(AsarError.INVALID_ARCHIVE, { asarPath })
         nextTick(callback, [error])
         return
       }
 
       const fileRealPath = archive.realpath(filePath)
       if (fileRealPath === false) {
-        const error = createError(AsarError.NOT_FOUND, {asarPath, filePath})
+        const error = createError(AsarError.NOT_FOUND, { asarPath, filePath })
         nextTick(callback, [error])
         return
       }
@@ -406,14 +406,14 @@
       })
     }
 
-    const {exists} = fs
+    const { exists } = fs
     fs.exists = (pathArgument, callback) => {
-      const {isAsar, asarPath, filePath} = splitPath(pathArgument)
+      const { isAsar, asarPath, filePath } = splitPath(pathArgument)
       if (!isAsar) return exists(pathArgument, callback)
 
       const archive = getOrCreateArchive(asarPath)
       if (!archive) {
-        const error = createError(AsarError.INVALID_ARCHIVE, {asarPath})
+        const error = createError(AsarError.INVALID_ARCHIVE, { asarPath })
         nextTick(callback, [error])
         return
       }
@@ -423,21 +423,21 @@
     }
 
     fs.exists[util.promisify.custom] = pathArgument => {
-      const {isAsar, asarPath, filePath} = splitPath(pathArgument)
+      const { isAsar, asarPath, filePath } = splitPath(pathArgument)
       if (!isAsar) return exists[util.promisify.custom](pathArgument)
 
       const archive = getOrCreateArchive(asarPath)
       if (!archive) {
-        const error = createError(AsarError.INVALID_ARCHIVE, {asarPath})
+        const error = createError(AsarError.INVALID_ARCHIVE, { asarPath })
         return Promise.reject(error)
       }
 
       return Promise.resolve(archive.stat(filePath) !== false)
     }
 
-    const {existsSync} = fs
+    const { existsSync } = fs
     fs.existsSync = pathArgument => {
-      const {isAsar, asarPath, filePath} = splitPath(pathArgument)
+      const { isAsar, asarPath, filePath } = splitPath(pathArgument)
       if (!isAsar) return existsSync(pathArgument)
 
       const archive = getOrCreateArchive(asarPath)
@@ -446,9 +446,9 @@
       return archive.stat(filePath) !== false
     }
 
-    const {access} = fs
+    const { access } = fs
     fs.access = function (pathArgument, mode, callback) {
-      const {isAsar, asarPath, filePath} = splitPath(pathArgument)
+      const { isAsar, asarPath, filePath } = splitPath(pathArgument)
       if (!isAsar) return access.apply(this, arguments)
 
       if (typeof mode === 'function') {
@@ -458,14 +458,14 @@
 
       const archive = getOrCreateArchive(asarPath)
       if (!archive) {
-        const error = createError(AsarError.INVALID_ARCHIVE, {asarPath})
+        const error = createError(AsarError.INVALID_ARCHIVE, { asarPath })
         nextTick(callback, [error])
         return
       }
 
       const info = archive.getFileInfo(filePath)
       if (!info) {
-        const error = createError(AsarError.NOT_FOUND, {asarPath, filePath})
+        const error = createError(AsarError.NOT_FOUND, { asarPath, filePath })
         nextTick(callback, [error])
         return
       }
@@ -477,13 +477,13 @@
 
       const stats = archive.stat(filePath)
       if (!stats) {
-        const error = createError(AsarError.NOT_FOUND, {asarPath, filePath})
+        const error = createError(AsarError.NOT_FOUND, { asarPath, filePath })
         nextTick(callback, [error])
         return
       }
 
       if (mode & fs.constants.W_OK) {
-        const error = createError(AsarError.NO_ACCESS, {asarPath, filePath})
+        const error = createError(AsarError.NO_ACCESS, { asarPath, filePath })
         nextTick(callback, [error])
         return
       }
@@ -491,21 +491,21 @@
       nextTick(callback)
     }
 
-    const {accessSync} = fs
+    const { accessSync } = fs
     fs.accessSync = function (pathArgument, mode) {
-      const {isAsar, asarPath, filePath} = splitPath(pathArgument)
+      const { isAsar, asarPath, filePath } = splitPath(pathArgument)
       if (!isAsar) return accessSync.apply(this, arguments)
 
       if (mode == null) mode = fs.constants.F_OK
 
       const archive = getOrCreateArchive(asarPath)
       if (!archive) {
-        throw createError(AsarError.INVALID_ARCHIVE, {asarPath})
+        throw createError(AsarError.INVALID_ARCHIVE, { asarPath })
       }
 
       const info = archive.getFileInfo(filePath)
       if (!info) {
-        throw createError(AsarError.NOT_FOUND, {asarPath, filePath})
+        throw createError(AsarError.NOT_FOUND, { asarPath, filePath })
       }
 
       if (info.unpacked) {
@@ -515,17 +515,17 @@
 
       const stats = archive.stat(filePath)
       if (!stats) {
-        throw createError(AsarError.NOT_FOUND, {asarPath, filePath})
+        throw createError(AsarError.NOT_FOUND, { asarPath, filePath })
       }
 
       if (mode & fs.constants.W_OK) {
-        throw createError(AsarError.NO_ACCESS, {asarPath, filePath})
+        throw createError(AsarError.NO_ACCESS, { asarPath, filePath })
       }
     }
 
-    const {readFile} = fs
+    const { readFile } = fs
     fs.readFile = function (pathArgument, options, callback) {
-      const {isAsar, asarPath, filePath} = splitPath(pathArgument)
+      const { isAsar, asarPath, filePath } = splitPath(pathArgument)
       if (!isAsar) return readFile.apply(this, arguments)
 
       if (typeof options === 'function') {
@@ -539,17 +539,17 @@
         throw new TypeError('Bad arguments')
       }
 
-      const {encoding} = options
+      const { encoding } = options
       const archive = getOrCreateArchive(asarPath)
       if (!archive) {
-        const error = createError(AsarError.INVALID_ARCHIVE, {asarPath})
+        const error = createError(AsarError.INVALID_ARCHIVE, { asarPath })
         nextTick(callback, [error])
         return
       }
 
       const info = archive.getFileInfo(filePath)
       if (!info) {
-        const error = createError(AsarError.NOT_FOUND, {asarPath, filePath})
+        const error = createError(AsarError.NOT_FOUND, { asarPath, filePath })
         nextTick(callback, [error])
         return
       }
@@ -567,7 +567,7 @@
       const buffer = Buffer.alloc(info.size)
       const fd = archive.getFd()
       if (!(fd >= 0)) {
-        const error = createError(AsarError.NOT_FOUND, {asarPath, filePath})
+        const error = createError(AsarError.NOT_FOUND, { asarPath, filePath })
         nextTick(callback, [error])
         return
       }
@@ -578,16 +578,16 @@
       })
     }
 
-    const {readFileSync} = fs
+    const { readFileSync } = fs
     fs.readFileSync = function (pathArgument, options) {
-      const {isAsar, asarPath, filePath} = splitPath(pathArgument)
+      const { isAsar, asarPath, filePath } = splitPath(pathArgument)
       if (!isAsar) return readFileSync.apply(this, arguments)
 
       const archive = getOrCreateArchive(asarPath)
-      if (!archive) throw createError(AsarError.INVALID_ARCHIVE, {asarPath})
+      if (!archive) throw createError(AsarError.INVALID_ARCHIVE, { asarPath })
 
       const info = archive.getFileInfo(filePath)
-      if (!info) throw createError(AsarError.NOT_FOUND, {asarPath, filePath})
+      if (!info) throw createError(AsarError.NOT_FOUND, { asarPath, filePath })
 
       if (info.size === 0) return (options) ? '' : Buffer.alloc(0)
       if (info.unpacked) {
@@ -603,31 +603,31 @@
         throw new TypeError('Bad arguments')
       }
 
-      const {encoding} = options
+      const { encoding } = options
       const buffer = Buffer.alloc(info.size)
       const fd = archive.getFd()
-      if (!(fd >= 0)) throw createError(AsarError.NOT_FOUND, {asarPath, filePath})
+      if (!(fd >= 0)) throw createError(AsarError.NOT_FOUND, { asarPath, filePath })
 
       logASARAccess(asarPath, filePath, info.offset)
       fs.readSync(fd, buffer, 0, info.size, info.offset)
       return (encoding) ? buffer.toString(encoding) : buffer
     }
 
-    const {readdir} = fs
+    const { readdir } = fs
     fs.readdir = function (pathArgument, callback) {
-      const {isAsar, asarPath, filePath} = splitPath(pathArgument)
+      const { isAsar, asarPath, filePath } = splitPath(pathArgument)
       if (!isAsar) return readdir.apply(this, arguments)
 
       const archive = getOrCreateArchive(asarPath)
       if (!archive) {
-        const error = createError(AsarError.INVALID_ARCHIVE, {asarPath})
+        const error = createError(AsarError.INVALID_ARCHIVE, { asarPath })
         nextTick(callback, [error])
         return
       }
 
       const files = archive.readdir(filePath)
       if (!files) {
-        const error = createError(AsarError.NOT_FOUND, {asarPath, filePath})
+        const error = createError(AsarError.NOT_FOUND, { asarPath, filePath })
         nextTick(callback, [error])
         return
       }
@@ -635,27 +635,27 @@
       nextTick(callback, [null, files])
     }
 
-    const {readdirSync} = fs
+    const { readdirSync } = fs
     fs.readdirSync = function (pathArgument) {
-      const {isAsar, asarPath, filePath} = splitPath(pathArgument)
+      const { isAsar, asarPath, filePath } = splitPath(pathArgument)
       if (!isAsar) return readdirSync.apply(this, arguments)
 
       const archive = getOrCreateArchive(asarPath)
       if (!archive) {
-        throw createError(AsarError.INVALID_ARCHIVE, {asarPath})
+        throw createError(AsarError.INVALID_ARCHIVE, { asarPath })
       }
 
       const files = archive.readdir(filePath)
       if (!files) {
-        throw createError(AsarError.NOT_FOUND, {asarPath, filePath})
+        throw createError(AsarError.NOT_FOUND, { asarPath, filePath })
       }
 
       return files
     }
 
-    const {internalModuleReadJSON} = process.binding('fs')
+    const { internalModuleReadJSON } = process.binding('fs')
     process.binding('fs').internalModuleReadJSON = pathArgument => {
-      const {isAsar, asarPath, filePath} = splitPath(pathArgument)
+      const { isAsar, asarPath, filePath } = splitPath(pathArgument)
       if (!isAsar) return internalModuleReadJSON(pathArgument)
 
       const archive = getOrCreateArchive(asarPath)
@@ -666,7 +666,7 @@
       if (info.size === 0) return ''
       if (info.unpacked) {
         const realPath = archive.copyFileOut(filePath)
-        return fs.readFileSync(realPath, {encoding: 'utf8'})
+        return fs.readFileSync(realPath, { encoding: 'utf8' })
       }
 
       const buffer = Buffer.alloc(info.size)
@@ -678,9 +678,9 @@
       return buffer.toString('utf8')
     }
 
-    const {internalModuleStat} = process.binding('fs')
+    const { internalModuleStat } = process.binding('fs')
     process.binding('fs').internalModuleStat = pathArgument => {
-      const {isAsar, asarPath, filePath} = splitPath(pathArgument)
+      const { isAsar, asarPath, filePath } = splitPath(pathArgument)
       if (!isAsar) return internalModuleStat(pathArgument)
 
       // -ENOENT
@@ -699,14 +699,14 @@
     // This is to work around the recursive looping bug of mkdirp since it is
     // widely used.
     if (process.platform === 'win32') {
-      const {mkdir} = fs
+      const { mkdir } = fs
       fs.mkdir = (pathArgument, mode, callback) => {
         if (typeof mode === 'function') {
           callback = mode
           mode = undefined
         }
 
-        const {isAsar, filePath} = splitPath(pathArgument)
+        const { isAsar, filePath } = splitPath(pathArgument)
         if (isAsar && filePath.length > 0) {
           const error = createError(AsarError.NOT_DIR)
           nextTick(callback, [error])
@@ -716,9 +716,9 @@
         mkdir(pathArgument, mode, callback)
       }
 
-      const {mkdirSync} = fs
+      const { mkdirSync } = fs
       fs.mkdirSync = function (pathArgument, mode) {
-        const {isAsar, filePath} = splitPath(pathArgument)
+        const { isAsar, filePath } = splitPath(pathArgument)
         if (isAsar && filePath.length) throw createError(AsarError.NOT_DIR)
         return mkdirSync(pathArgument, mode)
       }
@@ -729,7 +729,7 @@
     // called by `childProcess.{exec,execSync}`, causing
     // Electron to consider the full command as a single path
     // to an archive.
-    const {exec, execSync} = childProcess
+    const { exec, execSync } = childProcess
     childProcess.exec = invokeWithNoAsar(exec)
     childProcess.exec[util.promisify.custom] = invokeWithNoAsar(exec[util.promisify.custom])
     childProcess.execSync = invokeWithNoAsar(execSync)

+ 1 - 1
lib/common/init.js

@@ -43,7 +43,7 @@ if (process.type === 'browser') {
 
 if (process.platform === 'win32') {
   // Always returns EOF for stdin stream.
-  const {Readable} = require('stream')
+  const { Readable } = require('stream')
   const stdin = new Readable()
   stdin.push(null)
   process.__defineGetter__('stdin', function () {

+ 2 - 2
lib/isolated_renderer/init.js

@@ -2,7 +2,7 @@
 
 'use strict'
 
-const {send, sendSync} = binding
+const { send, sendSync } = binding
 
 const ipcRenderer = {
   send (...args) {
@@ -18,7 +18,7 @@ const ipcRenderer = {
   once () {}
 }
 
-let {guestInstanceId, hiddenPage, openerId, nativeWindowOpen} = binding
+let { guestInstanceId, hiddenPage, openerId, nativeWindowOpen } = binding
 if (guestInstanceId != null) guestInstanceId = parseInt(guestInstanceId)
 if (openerId != null) openerId = parseInt(openerId)
 

+ 1 - 1
lib/renderer/api/desktop-capturer.js

@@ -1,4 +1,4 @@
-const {ipcRenderer, nativeImage} = require('electron')
+const { ipcRenderer, nativeImage } = require('electron')
 
 const includes = [].includes
 let currentId = 0

+ 5 - 5
lib/renderer/api/exports/electron.js

@@ -5,11 +5,11 @@ const moduleList = require('../module-list')
 common.defineProperties(exports)
 
 for (const {
-        name,
-        file,
-        enabled = true,
-        private: isPrivate = false
-    } of moduleList) {
+  name,
+  file,
+  enabled = true,
+  private: isPrivate = false
+} of moduleList) {
   if (!enabled) {
     continue
   }

+ 4 - 4
lib/renderer/api/module-list.js

@@ -8,8 +8,8 @@ module.exports = [
     file: 'desktop-capturer',
     enabled: features.isDesktopCapturerEnabled()
   },
-  {name: 'ipcRenderer', file: 'ipc-renderer', enabled: true},
-  {name: 'remote', file: 'remote', enabled: true},
-  {name: 'screen', file: 'screen', enabled: true},
-  {name: 'webFrame', file: 'web-frame', enabled: true}
+  { name: 'ipcRenderer', file: 'ipc-renderer', enabled: true },
+  { name: 'remote', file: 'remote', enabled: true },
+  { name: 'screen', file: 'screen', enabled: true },
+  { name: 'webFrame', file: 'web-frame', enabled: true }
 ]

+ 5 - 5
lib/renderer/api/remote.js

@@ -1,7 +1,7 @@
 'use strict'
 
 const v8Util = process.atomBinding('v8_util')
-const {ipcRenderer, isPromise} = require('electron')
+const { ipcRenderer, isPromise } = require('electron')
 const resolvePromise = Promise.resolve.bind(Promise)
 
 const CallbacksRegistry = require('../callbacks-registry')
@@ -127,7 +127,7 @@ function setObjectMembers (ref, object, metaId, members) {
       let descriptorFunction = proxyFunctionProperties(remoteMemberFunction, metaId, member.name)
 
       descriptor.get = () => {
-        descriptorFunction.ref = ref  // The member should reference its object.
+        descriptorFunction.ref = ref // The member should reference its object.
         return descriptorFunction
       }
       // Enable monkey-patch the method
@@ -214,7 +214,7 @@ function metaToValue (meta) {
     value: () => meta.value,
     array: () => meta.members.map((member) => metaToValue(member)),
     buffer: () => bufferUtils.metaToBuffer(meta.value),
-    promise: () => resolvePromise({then: metaToValue(meta.then)}),
+    promise: () => resolvePromise({ then: metaToValue(meta.then) }),
     error: () => metaToPlainObject(meta),
     date: () => new Date(meta.value),
     exception: () => { throw metaToException(meta) }
@@ -261,7 +261,7 @@ function metaToValue (meta) {
 function metaToPlainObject (meta) {
   const obj = (() => meta.type === 'error' ? new Error() : {})()
   for (let i = 0; i < meta.members.length; i++) {
-    let {name, value} = meta.members[i]
+    let { name, value } = meta.members[i]
     obj[name] = value
   }
   return obj
@@ -350,7 +350,7 @@ const addBuiltinProperty = (name) => {
 
 const browserModules =
   require('../../common/api/module-list').concat(
-  require('../../browser/api/module-list'))
+    require('../../browser/api/module-list'))
 
 // And add a helper receiver for each one.
 browserModules

+ 2 - 2
lib/renderer/api/web-frame.js

@@ -1,7 +1,7 @@
 'use strict'
 
-const {EventEmitter} = require('events')
-const {webFrame, WebFrame} = process.atomBinding('web_frame')
+const { EventEmitter } = require('events')
+const { webFrame, WebFrame } = process.atomBinding('web_frame')
 
 // WebFrame is an EventEmitter.
 Object.setPrototypeOf(WebFrame.prototype, EventEmitter.prototype)

+ 3 - 3
lib/renderer/chrome-api.js

@@ -1,4 +1,4 @@
-const {ipcRenderer} = require('electron')
+const { ipcRenderer } = require('electron')
 const Event = require('./extensions/event')
 const url = require('url')
 
@@ -99,14 +99,14 @@ exports.injectTo = function (extensionId, isBackgroundPage, context) {
 
       // Parse the optional args.
       let targetExtensionId = extensionId
-      let connectInfo = {name: ''}
+      let connectInfo = { name: '' }
       if (args.length === 1) {
         connectInfo = args[0]
       } else if (args.length === 2) {
         [targetExtensionId, connectInfo] = args
       }
 
-      const {tabId, portId} = ipcRenderer.sendSync('CHROME_RUNTIME_CONNECT', targetExtensionId, connectInfo)
+      const { tabId, portId } = ipcRenderer.sendSync('CHROME_RUNTIME_CONNECT', targetExtensionId, connectInfo)
       return new Port(tabId, portId, extensionId, connectInfo.name)
     },
 

Some files were not shown because too many files changed in this diff