build: update to standard 14 (#24479)
This commit is contained in:
parent
9bd0fc5348
commit
eb6616e4e9
37 changed files with 495 additions and 665 deletions
|
@ -38,7 +38,7 @@ the window after this event will have no visual flash:
|
|||
|
||||
```javascript
|
||||
const { BrowserWindow } = require('electron')
|
||||
let win = new BrowserWindow({ show: false })
|
||||
const win = new BrowserWindow({ show: false })
|
||||
win.once('ready-to-show', () => {
|
||||
win.show()
|
||||
})
|
||||
|
@ -60,7 +60,7 @@ immediately, and use a `backgroundColor` close to your app's background:
|
|||
```javascript
|
||||
const { BrowserWindow } = require('electron')
|
||||
|
||||
let win = new BrowserWindow({ backgroundColor: '#2e2c29' })
|
||||
const win = new BrowserWindow({ backgroundColor: '#2e2c29' })
|
||||
win.loadURL('https://github.com')
|
||||
```
|
||||
|
||||
|
@ -74,8 +74,8 @@ By using `parent` option, you can create child windows:
|
|||
```javascript
|
||||
const { BrowserWindow } = require('electron')
|
||||
|
||||
let top = new BrowserWindow()
|
||||
let child = new BrowserWindow({ parent: top })
|
||||
const top = new BrowserWindow()
|
||||
const child = new BrowserWindow({ parent: top })
|
||||
child.show()
|
||||
top.show()
|
||||
```
|
||||
|
@ -90,7 +90,7 @@ window, you have to set both `parent` and `modal` options:
|
|||
```javascript
|
||||
const { BrowserWindow } = require('electron')
|
||||
|
||||
let child = new BrowserWindow({ parent: top, modal: true, show: false })
|
||||
const child = new BrowserWindow({ parent: top, modal: true, show: false })
|
||||
child.loadURL('https://github.com')
|
||||
child.once('ready-to-show', () => {
|
||||
child.show()
|
||||
|
@ -597,7 +597,7 @@ e.g. `APPCOMMAND_BROWSER_BACKWARD` is emitted as `browser-backward`.
|
|||
|
||||
```javascript
|
||||
const { BrowserWindow } = require('electron')
|
||||
let win = new BrowserWindow()
|
||||
const win = new BrowserWindow()
|
||||
win.on('app-command', (e, cmd) => {
|
||||
// Navigate the window back when the user hits their mouse back button
|
||||
if (cmd === 'browser-backward' && win.webContents.canGoBack()) {
|
||||
|
@ -772,7 +772,7 @@ To check if a DevTools extension is installed you can run the following:
|
|||
```javascript
|
||||
const { BrowserWindow } = require('electron')
|
||||
|
||||
let installed = BrowserWindow.getDevToolsExtensions().hasOwnProperty('devtron')
|
||||
const installed = 'devtron' in BrowserWindow.getDevToolsExtensions()
|
||||
console.log(installed)
|
||||
```
|
||||
|
||||
|
@ -789,7 +789,7 @@ Objects created with `new BrowserWindow` have the following properties:
|
|||
```javascript
|
||||
const { BrowserWindow } = require('electron')
|
||||
// In this example `win` is our instance
|
||||
let win = new BrowserWindow({ width: 800, height: 600 })
|
||||
const win = new BrowserWindow({ width: 800, height: 600 })
|
||||
win.loadURL('https://github.com')
|
||||
```
|
||||
|
||||
|
@ -1314,9 +1314,9 @@ a HTML-rendered toolbar. For example:
|
|||
|
||||
```javascript
|
||||
const { BrowserWindow } = require('electron')
|
||||
let win = new BrowserWindow()
|
||||
const win = new BrowserWindow()
|
||||
|
||||
let toolbarRect = document.getElementById('toolbar').getBoundingClientRect()
|
||||
const toolbarRect = document.getElementById('toolbar').getBoundingClientRect()
|
||||
win.setSheetOffset(toolbarRect.height)
|
||||
```
|
||||
|
||||
|
@ -1440,7 +1440,7 @@ Node's [`url.format`](https://nodejs.org/api/url.html#url_url_format_urlobject)
|
|||
method:
|
||||
|
||||
```javascript
|
||||
let url = require('url').format({
|
||||
const url = require('url').format({
|
||||
protocol: 'file',
|
||||
slashes: true,
|
||||
pathname: require('path').join(__dirname, 'index.html')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue