chore: update to standard 12

This commit is contained in:
Samuel Attard 2018-09-14 02:10:51 +10:00
parent 9e85bdb02c
commit 558fff69e7
No known key found for this signature in database
GPG key ID: E89DDE5742D58C4E
198 changed files with 4455 additions and 2940 deletions

View file

@ -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_