📝 Fix code style issue
* Change `var` to `let`. * Change `function() {}` to `() => {}`. * Use shorthand function syntax on object notation. * Remove spaces between object notation brackets. * Small fixes.
This commit is contained in:
parent
139a4f984a
commit
f1b184ef78
23 changed files with 64 additions and 67 deletions
|
@ -85,7 +85,7 @@ For example, to get a file with `$.get`:
|
|||
|
||||
```html
|
||||
<script>
|
||||
var $ = require('./jquery.min.js');
|
||||
let $ = require('./jquery.min.js');
|
||||
$.get('file:///path/to/example.asar/file.txt', (data) => {
|
||||
console.log(data);
|
||||
});
|
||||
|
|
|
@ -22,7 +22,7 @@ let myNotification = new Notification('Title', {
|
|||
body: 'Lorem Ipsum Dolor Sit Amet'
|
||||
});
|
||||
|
||||
myNotification.onclick = function () {
|
||||
myNotification.onclick = () => {
|
||||
console.log('Notification clicked');
|
||||
};
|
||||
```
|
||||
|
@ -118,7 +118,7 @@ const app = electron.app;
|
|||
const Menu = electron.Menu;
|
||||
|
||||
const dockMenu = Menu.buildFromTemplate([
|
||||
{ label: 'New Window', click: () => { console.log('New Window'); } },
|
||||
{ label: 'New Window', click() { console.log('New Window'); } },
|
||||
{ label: 'New Window with Settings', submenu: [
|
||||
{ label: 'Basic' },
|
||||
{ label: 'Pro'}
|
||||
|
@ -221,13 +221,13 @@ win.setThumbarButtons([
|
|||
{
|
||||
tooltip: 'button1',
|
||||
icon: path.join(__dirname, 'button1.png'),
|
||||
click: () => { console.log('button2 clicked'); }
|
||||
click() { console.log('button2 clicked'); }
|
||||
},
|
||||
{
|
||||
tooltip: 'button2',
|
||||
icon: path.join(__dirname, 'button2.png'),
|
||||
flags:['enabled', 'dismissonclick'],
|
||||
click: () => { console.log('button2 clicked.'); }
|
||||
flags: ['enabled', 'dismissonclick'],
|
||||
click() { console.log('button2 clicked.'); }
|
||||
}
|
||||
]);
|
||||
```
|
||||
|
|
|
@ -82,15 +82,15 @@ example being:
|
|||
```javascript
|
||||
const electron = require('electron');
|
||||
// Module to control application life.
|
||||
const app = electron.app;
|
||||
const {app} = electron;
|
||||
// Module to create native browser window.
|
||||
const BrowserWindow = electron.BrowserWindow;
|
||||
const {BrowserWindow} = electron;
|
||||
|
||||
// Keep a global reference of the window object, if you don't, the window will
|
||||
// be closed automatically when the JavaScript object is garbage collected.
|
||||
let mainWindow;
|
||||
|
||||
function createWindow () {
|
||||
function createWindow() {
|
||||
// Create the browser window.
|
||||
mainWindow = new BrowserWindow({width: 800, height: 600});
|
||||
|
||||
|
|
|
@ -59,7 +59,7 @@ driver.get('http://www.google.com');
|
|||
driver.findElement(webdriver.By.name('q')).sendKeys('webdriver');
|
||||
driver.findElement(webdriver.By.name('btnG')).click();
|
||||
driver.wait(() => {
|
||||
return driver.getTitle().then(function(title) {
|
||||
return driver.getTitle().then((title) => {
|
||||
return title === 'webdriver - Google Search';
|
||||
});
|
||||
}, 1000);
|
||||
|
@ -106,7 +106,7 @@ const options = {
|
|||
}
|
||||
};
|
||||
|
||||
var client = webdriverio.remote(options);
|
||||
let client = webdriverio.remote(options);
|
||||
|
||||
client
|
||||
.init()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue