Skip to content

Commit eb6616e

Browse files
build: update to standard 14 (electron#24479)
1 parent 9bd0fc5 commit eb6616e

37 files changed

+497
-667
lines changed

docs/api/app.md

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -990,6 +990,7 @@ if (!gotTheLock) {
990990

991991
// Create myWindow, load the rest of the app, etc...
992992
app.whenReady().then(() => {
993+
myWindow = createWindow()
993994
})
994995
}
995996
```
@@ -1105,8 +1106,10 @@ For `infoType` equal to `complete`:
11051106
For `infoType` equal to `basic`:
11061107
Promise is fulfilled with `Object` containing fewer attributes than when requested with `complete`. Here's an example of basic response:
11071108
```js
1108-
{ auxAttributes:
1109-
{ amdSwitchable: true,
1109+
{
1110+
auxAttributes:
1111+
{
1112+
amdSwitchable: true,
11101113
canSupportThreadedTextureMailbox: false,
11111114
directComposition: false,
11121115
directRendering: true,
@@ -1119,12 +1122,14 @@ For `infoType` equal to `basic`:
11191122
sandboxed: false,
11201123
softwareRendering: false,
11211124
supportsOverlays: false,
1122-
videoDecodeAcceleratorFlags: 0 },
1123-
gpuDevice:
1124-
[ { active: true, deviceId: 26657, vendorId: 4098 },
1125-
{ active: false, deviceId: 3366, vendorId: 32902 } ],
1126-
machineModelName: 'MacBookPro',
1127-
machineModelVersion: '11.5' }
1125+
videoDecodeAcceleratorFlags: 0
1126+
},
1127+
gpuDevice:
1128+
[{ active: true, deviceId: 26657, vendorId: 4098 },
1129+
{ active: false, deviceId: 3366, vendorId: 32902 }],
1130+
machineModelName: 'MacBookPro',
1131+
machineModelVersion: '11.5'
1132+
}
11281133
```
11291134

11301135
Using `basic` should be preferred if only basic information like `vendorId` or `driverId` is needed.

docs/api/browser-window.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ the window after this event will have no visual flash:
3838

3939
```javascript
4040
const { BrowserWindow } = require('electron')
41-
let win = new BrowserWindow({ show: false })
41+
const win = new BrowserWindow({ show: false })
4242
win.once('ready-to-show', () => {
4343
win.show()
4444
})
@@ -60,7 +60,7 @@ immediately, and use a `backgroundColor` close to your app's background:
6060
```javascript
6161
const { BrowserWindow } = require('electron')
6262

63-
let win = new BrowserWindow({ backgroundColor: '#2e2c29' })
63+
const win = new BrowserWindow({ backgroundColor: '#2e2c29' })
6464
win.loadURL('https://github.com')
6565
```
6666

@@ -74,8 +74,8 @@ By using `parent` option, you can create child windows:
7474
```javascript
7575
const { BrowserWindow } = require('electron')
7676

77-
let top = new BrowserWindow()
78-
let child = new BrowserWindow({ parent: top })
77+
const top = new BrowserWindow()
78+
const child = new BrowserWindow({ parent: top })
7979
child.show()
8080
top.show()
8181
```
@@ -90,7 +90,7 @@ window, you have to set both `parent` and `modal` options:
9090
```javascript
9191
const { BrowserWindow } = require('electron')
9292

93-
let child = new BrowserWindow({ parent: top, modal: true, show: false })
93+
const child = new BrowserWindow({ parent: top, modal: true, show: false })
9494
child.loadURL('https://github.com')
9595
child.once('ready-to-show', () => {
9696
child.show()
@@ -597,7 +597,7 @@ e.g. `APPCOMMAND_BROWSER_BACKWARD` is emitted as `browser-backward`.
597597

598598
```javascript
599599
const { BrowserWindow } = require('electron')
600-
let win = new BrowserWindow()
600+
const win = new BrowserWindow()
601601
win.on('app-command', (e, cmd) => {
602602
// Navigate the window back when the user hits their mouse back button
603603
if (cmd === 'browser-backward' && win.webContents.canGoBack()) {
@@ -772,7 +772,7 @@ To check if a DevTools extension is installed you can run the following:
772772
```javascript
773773
const { BrowserWindow } = require('electron')
774774

775-
let installed = BrowserWindow.getDevToolsExtensions().hasOwnProperty('devtron')
775+
const installed = 'devtron' in BrowserWindow.getDevToolsExtensions()
776776
console.log(installed)
777777
```
778778

@@ -789,7 +789,7 @@ Objects created with `new BrowserWindow` have the following properties:
789789
```javascript
790790
const { BrowserWindow } = require('electron')
791791
// In this example `win` is our instance
792-
let win = new BrowserWindow({ width: 800, height: 600 })
792+
const win = new BrowserWindow({ width: 800, height: 600 })
793793
win.loadURL('https://github.com')
794794
```
795795

@@ -1314,9 +1314,9 @@ a HTML-rendered toolbar. For example:
13141314

13151315
```javascript
13161316
const { BrowserWindow } = require('electron')
1317-
let win = new BrowserWindow()
1317+
const win = new BrowserWindow()
13181318

1319-
let toolbarRect = document.getElementById('toolbar').getBoundingClientRect()
1319+
const toolbarRect = document.getElementById('toolbar').getBoundingClientRect()
13201320
win.setSheetOffset(toolbarRect.height)
13211321
```
13221322

@@ -1440,7 +1440,7 @@ Node's [`url.format`](https://nodejs.org/api/url.html#url_url_format_urlobject)
14401440
method:
14411441

14421442
```javascript
1443-
let url = require('url').format({
1443+
const url = require('url').format({
14441444
protocol: 'file',
14451445
slashes: true,
14461446
pathname: require('path').join(__dirname, 'index.html')

docs/api/debugger.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ runtime that allows interacting with pages and instrumenting them.
99

1010
```javascript
1111
const { BrowserWindow } = require('electron')
12-
let win = new BrowserWindow()
12+
const win = new BrowserWindow()
1313

1414
try {
1515
win.webContents.debugger.attach('1.1')

docs/api/download-item.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ control the download item.
1111
```javascript
1212
// In the main process.
1313
const { BrowserWindow } = require('electron')
14-
let win = new BrowserWindow()
14+
const win = new BrowserWindow()
1515
win.webContents.session.on('will-download', (event, item, webContents) => {
1616
// Set the save path, making Electron not to prompt a save dialog.
1717
item.setSavePath('/tmp/save.pdf')

docs/api/frameless-window.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ To create a frameless window, you need to set `frame` to `false` in
1515

1616
```javascript
1717
const { BrowserWindow } = require('electron')
18-
let win = new BrowserWindow({ width: 800, height: 600, frame: false })
18+
const win = new BrowserWindow({ width: 800, height: 600, frame: false })
1919
win.show()
2020
```
2121

@@ -33,7 +33,7 @@ Results in a hidden title bar and a full size content window, yet the title bar
3333

3434
```javascript
3535
const { BrowserWindow } = require('electron')
36-
let win = new BrowserWindow({ titleBarStyle: 'hidden' })
36+
const win = new BrowserWindow({ titleBarStyle: 'hidden' })
3737
win.show()
3838
```
3939

@@ -43,7 +43,7 @@ Results in a hidden title bar with an alternative look where the traffic light b
4343

4444
```javascript
4545
const { BrowserWindow } = require('electron')
46-
let win = new BrowserWindow({ titleBarStyle: 'hiddenInset' })
46+
const win = new BrowserWindow({ titleBarStyle: 'hiddenInset' })
4747
win.show()
4848
```
4949

@@ -58,7 +58,7 @@ This option is only applicable for frameless windows.
5858

5959
```javascript
6060
const { BrowserWindow } = require('electron')
61-
let win = new BrowserWindow({ titleBarStyle: 'customButtonsOnHover', frame: false })
61+
const win = new BrowserWindow({ titleBarStyle: 'customButtonsOnHover', frame: false })
6262
win.show()
6363
```
6464

@@ -69,7 +69,7 @@ window transparent:
6969

7070
```javascript
7171
const { BrowserWindow } = require('electron')
72-
let win = new BrowserWindow({ transparent: true, frame: false })
72+
const win = new BrowserWindow({ transparent: true, frame: false })
7373
win.show()
7474
```
7575

@@ -100,7 +100,7 @@ API:
100100

101101
```javascript
102102
const { BrowserWindow } = require('electron')
103-
let win = new BrowserWindow()
103+
const win = new BrowserWindow()
104104
win.setIgnoreMouseEvents(true)
105105
```
106106

@@ -112,8 +112,8 @@ optional parameter can be used to forward mouse move messages to the web page,
112112
allowing events such as `mouseleave` to be emitted:
113113

114114
```javascript
115-
let win = require('electron').remote.getCurrentWindow()
116-
let el = document.getElementById('clickThroughElement')
115+
const win = require('electron').remote.getCurrentWindow()
116+
const el = document.getElementById('clickThroughElement')
117117
el.addEventListener('mouseenter', () => {
118118
win.setIgnoreMouseEvents(true, { forward: true })
119119
})

docs/api/remote.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ renderer process:
1717

1818
```javascript
1919
const { BrowserWindow } = require('electron').remote
20-
let win = new BrowserWindow({ width: 800, height: 600 })
20+
const win = new BrowserWindow({ width: 800, height: 600 })
2121
win.loadURL('https://github.com')
2222
```
2323

docs/api/screen.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ const { app, BrowserWindow, screen } = require('electron')
3333
let win
3434

3535
app.whenReady().then(() => {
36-
let displays = screen.getAllDisplays()
37-
let externalDisplay = displays.find((display) => {
36+
const displays = screen.getAllDisplays()
37+
const externalDisplay = displays.find((display) => {
3838
return display.bounds.x !== 0 || display.bounds.y !== 0
3939
})
4040

docs/api/session.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ property of [`WebContents`](web-contents.md), or from the `session` module.
1212
```javascript
1313
const { BrowserWindow } = require('electron')
1414

15-
let win = new BrowserWindow({ width: 800, height: 600 })
15+
const win = new BrowserWindow({ width: 800, height: 600 })
1616
win.loadURL('http://github.com')
1717

1818
const ses = win.webContents.session
@@ -332,7 +332,7 @@ verify proc.
332332

333333
```javascript
334334
const { BrowserWindow } = require('electron')
335-
let win = new BrowserWindow()
335+
const win = new BrowserWindow()
336336

337337
win.webContents.session.setCertificateVerifyProc((request, callback) => {
338338
const { hostname } = request
@@ -655,7 +655,7 @@ const path = require('path')
655655
app.whenReady().then(() => {
656656
const protocol = session.fromPartition('some-partition').protocol
657657
protocol.registerFileProtocol('atom', (request, callback) => {
658-
let url = request.url.substr(7)
658+
const url = request.url.substr(7)
659659
callback({ path: path.normalize(`${__dirname}/${url}`) })
660660
}, (error) => {
661661
if (error) console.error('Failed to register protocol')

docs/api/structures/trace-config.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ An example TraceConfig that roughly matches what Chrome DevTools records:
4141
'disabled-by-default-v8.cpu_profiler',
4242
'disabled-by-default-v8.cpu_profiler.hires'
4343
],
44-
excluded_categories: [ '*' ]
44+
excluded_categories: ['*']
4545
}
4646
```
4747

docs/api/system-preferences.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ not (transparent windows won't work correctly when DWM composition is disabled):
209209

210210
```javascript
211211
const { BrowserWindow, systemPreferences } = require('electron')
212-
let browserOptions = { width: 1000, height: 800 }
212+
const browserOptions = { width: 1000, height: 800 }
213213

214214
// Make the window transparent only if the platform supports it.
215215
if (process.platform !== 'win32' || systemPreferences.isAeroGlassEnabled()) {
@@ -218,7 +218,7 @@ if (process.platform !== 'win32' || systemPreferences.isAeroGlassEnabled()) {
218218
}
219219

220220
// Create the window.
221-
let win = new BrowserWindow(browserOptions)
221+
const win = new BrowserWindow(browserOptions)
222222

223223
// Navigate.
224224
if (browserOptions.transparent) {

0 commit comments

Comments
 (0)