From 4d7296e1dbe20e6e6fb728e48c701d398ede8beb Mon Sep 17 00:00:00 2001 From: Plusb Preco Date: Wed, 11 May 2016 01:26:38 +0900 Subject: [PATCH] :memo: Match destructuring style [ci skip] --- docs/api/app.md | 3 ++- docs/api/browser-window.md | 4 ++-- docs/api/chrome-command-line-switches.md | 2 +- docs/api/clipboard.md | 2 +- docs/api/content-tracing.md | 2 +- docs/api/crash-reporter.md | 2 +- docs/api/desktop-capturer.md | 2 +- docs/api/dialog.md | 5 +++-- docs/api/frameless-window.md | 2 +- docs/api/global-shortcut.md | 3 +-- docs/api/ipc-main.md | 4 ++-- docs/api/menu.md | 2 +- docs/api/power-save-blocker.md | 2 +- docs/api/remote.md | 2 +- docs/api/screen.md | 9 +++------ docs/api/session.md | 2 +- docs/api/shell.md | 2 +- docs/api/synopsis.md | 10 +++++----- docs/api/web-contents.md | 4 ++-- docs/api/web-frame.md | 2 +- docs/api/web-view-tag.md | 4 ++-- docs/tutorial/application-packaging.md | 2 +- docs/tutorial/desktop-environment-integration.md | 2 +- docs/tutorial/online-offline-events.md | 2 +- 24 files changed, 37 insertions(+), 39 deletions(-) diff --git a/docs/api/app.md b/docs/api/app.md index 00580c0..56586ab 100644 --- a/docs/api/app.md +++ b/docs/api/app.md @@ -6,7 +6,8 @@ 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(); }); diff --git a/docs/api/browser-window.md b/docs/api/browser-window.md index d4ed6c0..e15c53c 100644 --- a/docs/api/browser-window.md +++ b/docs/api/browser-window.md @@ -4,10 +4,10 @@ ```javascript // In the main process. -const { BrowserWindow } = require('electron'); +const {BrowserWindow} = require('electron'); // Or in the renderer process. -const { BrowserWindow } = require('electron').remote; +const {BrowserWindow} = require('electron').remote; let win = new BrowserWindow({ width: 800, height: 600, show: false }); win.on('closed', () => { diff --git a/docs/api/chrome-command-line-switches.md b/docs/api/chrome-command-line-switches.md index 71f669e..751d929 100644 --- a/docs/api/chrome-command-line-switches.md +++ b/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'); diff --git a/docs/api/clipboard.md b/docs/api/clipboard.md index 38bd865..9a8c730 100644 --- a/docs/api/clipboard.md +++ b/docs/api/clipboard.md @@ -5,7 +5,7 @@ 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'); ``` diff --git a/docs/api/content-tracing.md b/docs/api/content-tracing.md index e6f6b7a..8df1ca6 100644 --- a/docs/api/content-tracing.md +++ b/docs/api/content-tracing.md @@ -8,7 +8,7 @@ This module does not include a web interface so you need to open result. ```javascript -const { contentTracing } = require('electron'); +const {contentTracing} = require('electron'); const options = { categoryFilter: '*', diff --git a/docs/api/crash-reporter.md b/docs/api/crash-reporter.md index 4e4b49d..6575bbe 100644 --- a/docs/api/crash-reporter.md +++ b/docs/api/crash-reporter.md @@ -6,7 +6,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', diff --git a/docs/api/desktop-capturer.md b/docs/api/desktop-capturer.md index dd37d3b..20e6d86 100644 --- a/docs/api/desktop-capturer.md +++ b/docs/api/desktop-capturer.md @@ -5,7 +5,7 @@ microphone, camera, or screen. ```javascript // In the renderer process. -var { desktopCapturer } = require('electron'); +const {desktopCapturer} = require('electron'); desktopCapturer.getSources({types: ['window', 'screen']}, (error, sources) => { if (error) throw error; diff --git a/docs/api/dialog.md b/docs/api/dialog.md index 84aac7c..c5cc022 100644 --- a/docs/api/dialog.md +++ b/docs/api/dialog.md @@ -6,7 +6,8 @@ An example of showing a dialog to select multiple files and directories: ```javascript var win = ...; // BrowserWindow in which to show the dialog -const { dialog } = require('electron'); +const {dialog} = require('electron'); + console.log(dialog.showOpenDialog({ properties: [ 'openFile', 'openDirectory', 'multiSelections' ]})); ``` @@ -14,7 +15,7 @@ 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; ``` ## Methods diff --git a/docs/api/frameless-window.md b/docs/api/frameless-window.md index 733baa5..fd0f5d4 100644 --- a/docs/api/frameless-window.md +++ b/docs/api/frameless-window.md @@ -14,7 +14,7 @@ To create a frameless window, you need to set `frame` to `false` in ```javascript -const { BrowserWindow } = require('electron'); +const {BrowserWindow} = require('electron'); let win = new BrowserWindow({ width: 800, height: 600, frame: false }); ``` diff --git a/docs/api/global-shortcut.md b/docs/api/global-shortcut.md index 6acb520..d611423 100644 --- a/docs/api/global-shortcut.md +++ b/docs/api/global-shortcut.md @@ -11,8 +11,7 @@ not have the keyboard focus. You should not use this module until the `ready` event of the app module is emitted. ```javascript -const electron = require('electron'); -const { app, globalShortcut } = electron; +const {app, globalShortcut} = require('electron'); app.on('ready', () => { // Register a 'CommandOrControl+X' shortcut listener. diff --git a/docs/api/ipc-main.md b/docs/api/ipc-main.md index e40e440..0b7acbf 100644 --- a/docs/api/ipc-main.md +++ b/docs/api/ipc-main.md @@ -23,7 +23,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'); @@ -37,7 +37,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) => { diff --git a/docs/api/menu.md b/docs/api/menu.md index 53ba943..133b681 100644 --- a/docs/api/menu.md +++ b/docs/api/menu.md @@ -15,7 +15,7 @@ the user right clicks the page: ```html @@ -53,7 +53,7 @@ As of 0.37, you can use built-in modules. ```javascript -const { app, BrowserWindow } = require('electron'); +const {app, BrowserWindow} = require('electron'); ``` If you need the entire `electron` module, you can require it and then using @@ -61,7 +61,7 @@ destructuring to access the individual modules from `electron`. ```javascript const electron = require('electron'); -const { app, BrowserWindow } = electron; +const {app, BrowserWindow} = electron; ``` This is equivalent to the following code: diff --git a/docs/api/web-contents.md b/docs/api/web-contents.md index cd4b9f2..f5c3d38 100644 --- a/docs/api/web-contents.md +++ b/docs/api/web-contents.md @@ -9,7 +9,7 @@ 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}); win.loadURL('http://github.com'); @@ -673,7 +673,7 @@ By default, an empty `options` will be regarded as: ``` ```javascript -const { BrowserWindow } = require('electron'); +const {BrowserWindow} = require('electron'); const fs = require('fs'); let win = new BrowserWindow({width: 800, height: 600}); diff --git a/docs/api/web-frame.md b/docs/api/web-frame.md index e7ed055..f77e2ce 100644 --- a/docs/api/web-frame.md +++ b/docs/api/web-frame.md @@ -5,7 +5,7 @@ An example of zooming current page to 200%. ```javascript -const { webFrame } = require('electron'); +const {webFrame} = require('electron'); webFrame.setZoomFactor(2); ``` diff --git a/docs/api/web-view-tag.md b/docs/api/web-view-tag.md index da23658..481d0b2 100644 --- a/docs/api/web-view-tag.md +++ b/docs/api/web-view-tag.md @@ -644,7 +644,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'); webview.addEventListener('new-window', (e) => { const protocol = require('url').parse(e.url).protocol; @@ -732,7 +732,7 @@ webview.send('ping'); ```javascript // In guest page. -var { ipcRenderer } = require('electron'); +const {ipcRenderer} = require('electron'); ipcRenderer.on('ping', () => { ipcRenderer.sendToHost('pong'); }); diff --git a/docs/tutorial/application-packaging.md b/docs/tutorial/application-packaging.md index 257119a..f1c100e 100644 --- a/docs/tutorial/application-packaging.md +++ b/docs/tutorial/application-packaging.md @@ -71,7 +71,7 @@ require('/path/to/example.asar/dir/module.js'); You can also display a web page in an `asar` archive with `BrowserWindow`: ```javascript -const { BrowserWindow } = require('electron'); +const {BrowserWindow} = require('electron'); let win = new BrowserWindow({width: 800, height: 600}); win.loadURL('file:///path/to/example.asar/static/index.html'); ``` diff --git a/docs/tutorial/desktop-environment-integration.md b/docs/tutorial/desktop-environment-integration.md index 939da46..dd7826c 100644 --- a/docs/tutorial/desktop-environment-integration.md +++ b/docs/tutorial/desktop-environment-integration.md @@ -209,7 +209,7 @@ You can use [BrowserWindow.setThumbarButtons][setthumbarbuttons] to set thumbnail toolbar in your application: ```javascript -const { BrowserWindow } = require('electron'); +const {BrowserWindow} = require('electron'); const path = require('path'); let win = new BrowserWindow({ diff --git a/docs/tutorial/online-offline-events.md b/docs/tutorial/online-offline-events.md index 7e784e3..2b7a6d7 100644 --- a/docs/tutorial/online-offline-events.md +++ b/docs/tutorial/online-offline-events.md @@ -71,7 +71,7 @@ _online-status.html_