Skip to content

Commit

Permalink
chore: update to standard 12
Browse files Browse the repository at this point in the history
  • Loading branch information
MarshallOfSound committed Sep 14, 2018
1 parent 9e85bdb commit 558fff6
Show file tree
Hide file tree
Showing 198 changed files with 4,481 additions and 2,966 deletions.
2 changes: 1 addition & 1 deletion default_app/default_app.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const {app, BrowserWindow} = require('electron')
const { app, BrowserWindow } = require('electron')
const path = require('path')

let mainWindow = null
Expand Down
2 changes: 1 addition & 1 deletion default_app/main.js
Original file line number Diff line number Diff line change
@@ -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')
Expand Down
4 changes: 2 additions & 2 deletions default_app/renderer.js
Original file line number Diff line number Diff line change
@@ -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')
Expand All @@ -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) => {
Expand Down
2 changes: 1 addition & 1 deletion docs/api/accelerator.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
18 changes: 9 additions & 9 deletions docs/api/app.md
Original file line number Diff line number Diff line change
Expand Up @@ -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()
})
Expand Down Expand Up @@ -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') {
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
```

Expand Down Expand Up @@ -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([
{
Expand Down Expand Up @@ -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()
Expand Down
22 changes: 11 additions & 11 deletions docs/api/breaking-changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand All @@ -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>`
Expand Down Expand Up @@ -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)
```

Expand All @@ -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`
Expand Down
4 changes: 2 additions & 2 deletions docs/api/browser-view.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
})
Expand Down
34 changes: 17 additions & 17 deletions docs/api/browser-window.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
})
Expand Down Expand Up @@ -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()
})
Expand All @@ -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')
```

Expand All @@ -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()
```
Expand All @@ -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()
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand All @@ -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')
```

Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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_

Expand Down
4 changes: 2 additions & 2 deletions docs/api/chrome-command-line-switches.md
Original file line number Diff line number Diff line change
Expand Up @@ -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')

Expand Down Expand Up @@ -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')
```

Expand Down
10 changes: 5 additions & 5 deletions docs/api/clipboard.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ 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')
```

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'))
```
Expand Down Expand Up @@ -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>'))
```

Expand Down Expand Up @@ -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.
2 changes: 1 addition & 1 deletion docs/api/content-tracing.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ module is emitted.


```javascript
const {app, contentTracing} = require('electron')
const { app, contentTracing } = require('electron')

app.on('ready', () => {
const options = {
Expand Down
6 changes: 3 additions & 3 deletions docs/api/cookies.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,21 @@ a `Session`.
For example:

```javascript
const {session} = require('electron')
const { session } = require('electron')

// Query all cookies.
session.defaultSession.cookies.get({}, (error, cookies) => {
console.log(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)
})
Expand Down
Loading

0 comments on commit 558fff6

Please sign in to comment.