chore: update to standard 12
This commit is contained in:
parent
9e85bdb02c
commit
558fff69e7
198 changed files with 4455 additions and 2940 deletions
|
@ -2,14 +2,14 @@
|
|||
|
||||
const bindings = process.atomBinding('app')
|
||||
const path = require('path')
|
||||
const {app, App} = bindings
|
||||
const { app, App } = bindings
|
||||
|
||||
// Only one app object permitted.
|
||||
module.exports = app
|
||||
|
||||
const electron = require('electron')
|
||||
const {deprecate, Menu} = electron
|
||||
const {EventEmitter} = require('events')
|
||||
const { deprecate, Menu } = electron
|
||||
const { EventEmitter } = require('events')
|
||||
|
||||
let dockMenu = null
|
||||
|
||||
|
@ -113,5 +113,5 @@ for (let name of events) {
|
|||
}
|
||||
|
||||
// Wrappers for native classes.
|
||||
const {DownloadItem} = process.atomBinding('download_item')
|
||||
const { DownloadItem } = process.atomBinding('download_item')
|
||||
Object.setPrototypeOf(DownloadItem.prototype, EventEmitter.prototype)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
const EventEmitter = require('events').EventEmitter
|
||||
const {autoUpdater, AutoUpdater} = process.atomBinding('auto_updater')
|
||||
const { autoUpdater, AutoUpdater } = process.atomBinding('auto_updater')
|
||||
|
||||
// AutoUpdater is an EventEmitter.
|
||||
Object.setPrototypeOf(AutoUpdater.prototype, EventEmitter.prototype)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
'use strict'
|
||||
|
||||
const {app} = require('electron')
|
||||
const {EventEmitter} = require('events')
|
||||
const { app } = require('electron')
|
||||
const { EventEmitter } = require('events')
|
||||
const squirrelUpdate = require('./squirrel-update-win')
|
||||
|
||||
class AutoUpdater extends EventEmitter {
|
||||
|
@ -54,7 +54,7 @@ class AutoUpdater extends EventEmitter {
|
|||
if (error != null) {
|
||||
return this.emitError(error)
|
||||
}
|
||||
const {releaseNotes, version} = update
|
||||
const { releaseNotes, version } = update
|
||||
// Date is not available on Windows, so fake it.
|
||||
const date = new Date()
|
||||
this.emit('update-downloaded', {}, releaseNotes, version, date, this.updateURL, () => {
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
|
||||
const electron = require('electron')
|
||||
|
||||
const {LayoutManager} = electron
|
||||
const {BoxLayout} = process.atomBinding('box_layout')
|
||||
const { LayoutManager } = electron
|
||||
const { BoxLayout } = process.atomBinding('box_layout')
|
||||
|
||||
Object.setPrototypeOf(BoxLayout.prototype, LayoutManager.prototype)
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
'use strict'
|
||||
|
||||
const {EventEmitter} = require('events')
|
||||
const {BrowserView} = process.atomBinding('browser_view')
|
||||
const { EventEmitter } = require('events')
|
||||
const { BrowserView } = process.atomBinding('browser_view')
|
||||
|
||||
Object.setPrototypeOf(BrowserView.prototype, EventEmitter.prototype)
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
'use strict'
|
||||
|
||||
const electron = require('electron')
|
||||
const {ipcMain, WebContentsView, TopLevelWindow} = electron
|
||||
const {BrowserWindow} = process.atomBinding('window')
|
||||
const { ipcMain, WebContentsView, TopLevelWindow } = electron
|
||||
const { BrowserWindow } = process.atomBinding('window')
|
||||
const v8Util = process.atomBinding('v8_util')
|
||||
|
||||
Object.setPrototypeOf(BrowserWindow.prototype, TopLevelWindow.prototype)
|
||||
|
@ -12,35 +12,35 @@ BrowserWindow.prototype._init = function () {
|
|||
TopLevelWindow.prototype._init.call(this)
|
||||
|
||||
// Avoid recursive require.
|
||||
const {app} = electron
|
||||
const { app } = electron
|
||||
|
||||
// Create WebContentsView.
|
||||
this.setContentView(new WebContentsView(this.webContents))
|
||||
|
||||
// Make new windows requested by links behave like "window.open"
|
||||
this.webContents.on('-new-window', (event, url, frameName, disposition,
|
||||
additionalFeatures, postData,
|
||||
referrer) => {
|
||||
additionalFeatures, postData,
|
||||
referrer) => {
|
||||
const options = {
|
||||
show: true,
|
||||
width: 800,
|
||||
height: 600
|
||||
}
|
||||
ipcMain.emit('ELECTRON_GUEST_WINDOW_MANAGER_INTERNAL_WINDOW_OPEN',
|
||||
event, url, referrer, frameName, disposition,
|
||||
options, additionalFeatures, postData)
|
||||
event, url, referrer, frameName, disposition,
|
||||
options, additionalFeatures, postData)
|
||||
})
|
||||
|
||||
this.webContents.on('-web-contents-created', (event, webContents, url,
|
||||
frameName) => {
|
||||
v8Util.setHiddenValue(webContents, 'url-framename', {url, frameName})
|
||||
frameName) => {
|
||||
v8Util.setHiddenValue(webContents, 'url-framename', { url, frameName })
|
||||
})
|
||||
|
||||
// Create a new browser window for the native implementation of
|
||||
// "window.open", used in sandbox and nativeWindowOpen mode
|
||||
this.webContents.on('-add-new-contents', (event, webContents, disposition,
|
||||
userGesture, left, top, width,
|
||||
height) => {
|
||||
userGesture, left, top, width,
|
||||
height) => {
|
||||
let urlFrameName = v8Util.getHiddenValue(webContents, 'url-framename')
|
||||
if ((disposition !== 'foreground-tab' && disposition !== 'new-window' &&
|
||||
disposition !== 'background-tab') || !urlFrameName) {
|
||||
|
@ -48,7 +48,7 @@ BrowserWindow.prototype._init = function () {
|
|||
return
|
||||
}
|
||||
|
||||
let {url, frameName} = urlFrameName
|
||||
let { url, frameName } = urlFrameName
|
||||
v8Util.deleteHiddenValue(webContents, 'url-framename')
|
||||
const options = {
|
||||
show: true,
|
||||
|
@ -60,7 +60,7 @@ BrowserWindow.prototype._init = function () {
|
|||
}
|
||||
const referrer = { url: '', policy: 'default' }
|
||||
ipcMain.emit('ELECTRON_GUEST_WINDOW_MANAGER_INTERNAL_WINDOW_OPEN',
|
||||
event, url, referrer, frameName, disposition, options)
|
||||
event, url, referrer, frameName, disposition, options)
|
||||
})
|
||||
|
||||
// window.resizeTo(...)
|
||||
|
@ -167,7 +167,7 @@ BrowserWindow.fromBrowserView = (browserView) => {
|
|||
|
||||
BrowserWindow.fromDevToolsWebContents = (webContents) => {
|
||||
for (const window of BrowserWindow.getAllWindows()) {
|
||||
const {devToolsWebContents} = window
|
||||
const { devToolsWebContents } = window
|
||||
if (devToolsWebContents != null && devToolsWebContents.equal(webContents)) {
|
||||
return window
|
||||
}
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
|
||||
const electron = require('electron')
|
||||
|
||||
const {View} = electron
|
||||
const {Button} = process.atomBinding('button')
|
||||
const { View } = electron
|
||||
const { Button } = process.atomBinding('button')
|
||||
|
||||
Object.setPrototypeOf(Button.prototype, View.prototype)
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
'use strict'
|
||||
|
||||
const {app, BrowserWindow} = require('electron')
|
||||
const { app, BrowserWindow } = require('electron')
|
||||
const binding = process.atomBinding('dialog')
|
||||
const v8Util = process.atomBinding('v8_util')
|
||||
|
||||
|
@ -83,7 +83,7 @@ module.exports = {
|
|||
}
|
||||
}
|
||||
|
||||
let {buttonLabel, defaultPath, filters, properties, title, message, securityScopedBookmarks = false} = options
|
||||
let { buttonLabel, defaultPath, filters, properties, title, message, securityScopedBookmarks = false } = options
|
||||
|
||||
if (properties == null) {
|
||||
properties = ['openFile']
|
||||
|
@ -129,7 +129,7 @@ module.exports = {
|
|||
const wrappedCallback = typeof callback === 'function' ? function (success, result, bookmarkData) {
|
||||
return success ? callback(result, bookmarkData) : callback()
|
||||
} : null
|
||||
const settings = {title, buttonLabel, defaultPath, filters, message, securityScopedBookmarks, window}
|
||||
const settings = { title, buttonLabel, defaultPath, filters, message, securityScopedBookmarks, window }
|
||||
settings.properties = dialogProperties
|
||||
return binding.showOpenDialog(settings, wrappedCallback)
|
||||
},
|
||||
|
@ -145,7 +145,7 @@ module.exports = {
|
|||
}
|
||||
}
|
||||
|
||||
let {buttonLabel, defaultPath, filters, title, message, securityScopedBookmarks = false, nameFieldLabel, showsTagField} = options
|
||||
let { buttonLabel, defaultPath, filters, title, message, securityScopedBookmarks = false, nameFieldLabel, showsTagField } = options
|
||||
|
||||
if (title == null) {
|
||||
title = ''
|
||||
|
@ -188,7 +188,7 @@ module.exports = {
|
|||
const wrappedCallback = typeof callback === 'function' ? function (success, result, bookmarkData) {
|
||||
return success ? callback(result, bookmarkData) : callback()
|
||||
} : null
|
||||
const settings = {title, buttonLabel, defaultPath, filters, message, securityScopedBookmarks, nameFieldLabel, showsTagField, window}
|
||||
const settings = { title, buttonLabel, defaultPath, filters, message, securityScopedBookmarks, nameFieldLabel, showsTagField, window }
|
||||
return binding.showSaveDialog(settings, wrappedCallback)
|
||||
},
|
||||
|
||||
|
@ -275,8 +275,8 @@ module.exports = {
|
|||
|
||||
const flags = options.noLink ? messageBoxOptions.noLink : 0
|
||||
return binding.showMessageBox(messageBoxType, buttons, defaultId, cancelId,
|
||||
flags, title, message, detail, checkboxLabel,
|
||||
checkboxChecked, icon, window, callback)
|
||||
flags, title, message, detail, checkboxLabel,
|
||||
checkboxChecked, icon, window, callback)
|
||||
},
|
||||
|
||||
showErrorBox: function (...args) {
|
||||
|
@ -290,7 +290,7 @@ module.exports = {
|
|||
throw new TypeError('options must be an object')
|
||||
}
|
||||
|
||||
let {certificate, message} = options
|
||||
let { certificate, message } = options
|
||||
if (certificate == null || typeof certificate !== 'object') {
|
||||
throw new TypeError('certificate must be an object')
|
||||
}
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
'use strict'
|
||||
|
||||
if (process.platform === 'darwin') {
|
||||
const {EventEmitter} = require('events')
|
||||
const {inAppPurchase, InAppPurchase} = process.atomBinding('in_app_purchase')
|
||||
const { EventEmitter } = require('events')
|
||||
const { inAppPurchase, InAppPurchase } = process.atomBinding('in_app_purchase')
|
||||
|
||||
// inAppPurchase is an EventEmitter.
|
||||
Object.setPrototypeOf(InAppPurchase.prototype, EventEmitter.prototype)
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
|
||||
const electron = require('electron')
|
||||
|
||||
const {Button} = electron
|
||||
const {LabelButton} = process.atomBinding('label_button')
|
||||
const { Button } = electron
|
||||
const { LabelButton } = process.atomBinding('label_button')
|
||||
|
||||
Object.setPrototypeOf(LabelButton.prototype, Button.prototype)
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
'use strict'
|
||||
|
||||
const {LayoutManager} = process.atomBinding('layout_manager')
|
||||
const { LayoutManager } = process.atomBinding('layout_manager')
|
||||
|
||||
LayoutManager.prototype._init = function () {
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
const {app} = require('electron')
|
||||
const { app } = require('electron')
|
||||
|
||||
const roles = {
|
||||
about: {
|
||||
|
@ -244,7 +244,7 @@ exports.getDefaultAccelerator = (role) => {
|
|||
exports.getDefaultSubmenu = (role) => {
|
||||
if (!roles.hasOwnProperty(role)) return
|
||||
|
||||
let {submenu} = roles[role]
|
||||
let { submenu } = roles[role]
|
||||
|
||||
// remove null items from within the submenu
|
||||
if (Array.isArray(submenu)) {
|
||||
|
@ -257,7 +257,7 @@ exports.getDefaultSubmenu = (role) => {
|
|||
exports.execute = (role, focusedWindow, focusedWebContents) => {
|
||||
if (!canExecuteRole(role)) return false
|
||||
|
||||
const {appMethod, webContentsMethod, windowMethod} = roles[role]
|
||||
const { appMethod, webContentsMethod, windowMethod } = roles[role]
|
||||
|
||||
if (appMethod) {
|
||||
app[appMethod]()
|
||||
|
|
|
@ -5,7 +5,7 @@ const roles = require('./menu-item-roles')
|
|||
let nextCommandId = 0
|
||||
|
||||
const MenuItem = function (options) {
|
||||
const {Menu} = require('electron')
|
||||
const { Menu } = require('electron')
|
||||
|
||||
// Preserve extra fields specified by user
|
||||
for (let key in options) {
|
||||
|
|
|
@ -165,4 +165,4 @@ function sortMenuItems (menuItems) {
|
|||
return joined
|
||||
}
|
||||
|
||||
module.exports = {sortMenuItems}
|
||||
module.exports = { sortMenuItems }
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
'use strict'
|
||||
|
||||
const {TopLevelWindow, MenuItem, webContents} = require('electron')
|
||||
const {sortMenuItems} = require('./menu-utils')
|
||||
const { TopLevelWindow, MenuItem, webContents } = require('electron')
|
||||
const { sortMenuItems } = require('./menu-utils')
|
||||
const EventEmitter = require('events').EventEmitter
|
||||
const v8Util = process.atomBinding('v8_util')
|
||||
const bindings = process.atomBinding('menu')
|
||||
|
||||
const {Menu} = bindings
|
||||
const { Menu } = bindings
|
||||
let applicationMenu = null
|
||||
let groupIdIndex = 0
|
||||
|
||||
|
@ -51,7 +51,7 @@ Menu.prototype.popup = function (options = {}) {
|
|||
if (options == null || typeof options !== 'object') {
|
||||
throw new TypeError('Options must be an object')
|
||||
}
|
||||
let {window, x, y, positioningItem, callback} = options
|
||||
let { window, x, y, positioningItem, callback } = options
|
||||
|
||||
// no callback passed
|
||||
if (!callback || typeof callback !== 'function') callback = () => {}
|
||||
|
@ -175,7 +175,7 @@ Menu.buildFromTemplate = function (template) {
|
|||
// validate the template against having the wrong attribute
|
||||
function areValidTemplateItems (template) {
|
||||
return template.every(item =>
|
||||
item != null && typeof item === 'object' && (item.hasOwnProperty('label') || item.hasOwnProperty('role') || item.type === 'separator'))
|
||||
item != null && typeof item === 'object' && (item.hasOwnProperty('label') || item.hasOwnProperty('role') || item.type === 'separator'))
|
||||
}
|
||||
|
||||
function sortTemplate (template) {
|
||||
|
|
|
@ -2,42 +2,42 @@ const features = process.atomBinding('features')
|
|||
|
||||
// Browser side modules, please sort alphabetically.
|
||||
module.exports = [
|
||||
{name: 'app', file: 'app'},
|
||||
{name: 'autoUpdater', file: 'auto-updater'},
|
||||
{name: 'BrowserView', file: 'browser-view'},
|
||||
{name: 'BrowserWindow', file: 'browser-window'},
|
||||
{name: 'contentTracing', file: 'content-tracing'},
|
||||
{name: 'dialog', file: 'dialog'},
|
||||
{name: 'globalShortcut', file: 'global-shortcut'},
|
||||
{name: 'ipcMain', file: 'ipc-main'},
|
||||
{name: 'inAppPurchase', file: 'in-app-purchase'},
|
||||
{name: 'Menu', file: 'menu'},
|
||||
{name: 'MenuItem', file: 'menu-item'},
|
||||
{name: 'net', file: 'net'},
|
||||
{name: 'netLog', file: 'net-log'},
|
||||
{name: 'Notification', file: 'notification'},
|
||||
{name: 'powerMonitor', file: 'power-monitor'},
|
||||
{name: 'powerSaveBlocker', file: 'power-save-blocker'},
|
||||
{name: 'protocol', file: 'protocol'},
|
||||
{name: 'screen', file: 'screen'},
|
||||
{name: 'session', file: 'session'},
|
||||
{name: 'systemPreferences', file: 'system-preferences'},
|
||||
{name: 'TopLevelWindow', file: 'top-level-window'},
|
||||
{name: 'TouchBar', file: 'touch-bar'},
|
||||
{name: 'Tray', file: 'tray'},
|
||||
{name: 'View', file: 'view'},
|
||||
{name: 'webContents', file: 'web-contents'},
|
||||
{name: 'WebContentsView', file: 'web-contents-view'},
|
||||
{ name: 'app', file: 'app' },
|
||||
{ name: 'autoUpdater', file: 'auto-updater' },
|
||||
{ name: 'BrowserView', file: 'browser-view' },
|
||||
{ name: 'BrowserWindow', file: 'browser-window' },
|
||||
{ name: 'contentTracing', file: 'content-tracing' },
|
||||
{ name: 'dialog', file: 'dialog' },
|
||||
{ name: 'globalShortcut', file: 'global-shortcut' },
|
||||
{ name: 'ipcMain', file: 'ipc-main' },
|
||||
{ name: 'inAppPurchase', file: 'in-app-purchase' },
|
||||
{ name: 'Menu', file: 'menu' },
|
||||
{ name: 'MenuItem', file: 'menu-item' },
|
||||
{ name: 'net', file: 'net' },
|
||||
{ name: 'netLog', file: 'net-log' },
|
||||
{ name: 'Notification', file: 'notification' },
|
||||
{ name: 'powerMonitor', file: 'power-monitor' },
|
||||
{ name: 'powerSaveBlocker', file: 'power-save-blocker' },
|
||||
{ name: 'protocol', file: 'protocol' },
|
||||
{ name: 'screen', file: 'screen' },
|
||||
{ name: 'session', file: 'session' },
|
||||
{ name: 'systemPreferences', file: 'system-preferences' },
|
||||
{ name: 'TopLevelWindow', file: 'top-level-window' },
|
||||
{ name: 'TouchBar', file: 'touch-bar' },
|
||||
{ name: 'Tray', file: 'tray' },
|
||||
{ name: 'View', file: 'view' },
|
||||
{ name: 'webContents', file: 'web-contents' },
|
||||
{ name: 'WebContentsView', file: 'web-contents-view' },
|
||||
// The internal modules, invisible unless you know their names.
|
||||
{name: 'NavigationController', file: 'navigation-controller', private: true}
|
||||
{ name: 'NavigationController', file: 'navigation-controller', private: true }
|
||||
]
|
||||
|
||||
if (features.isViewApiEnabled()) {
|
||||
module.exports.push(
|
||||
{name: 'BoxLayout', file: 'box-layout'},
|
||||
{name: 'Button', file: 'button'},
|
||||
{name: 'LabelButton', file: 'label-button'},
|
||||
{name: 'LayoutManager', file: 'layout-manager'},
|
||||
{name: 'TextField', file: 'text-field'}
|
||||
{ name: 'BoxLayout', file: 'box-layout' },
|
||||
{ name: 'Button', file: 'button' },
|
||||
{ name: 'LabelButton', file: 'label-button' },
|
||||
{ name: 'LayoutManager', file: 'layout-manager' },
|
||||
{ name: 'TextField', file: 'text-field' }
|
||||
)
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
'use strict'
|
||||
|
||||
const {ipcMain} = require('electron')
|
||||
const { ipcMain } = require('electron')
|
||||
|
||||
// The history operation in renderer is redirected to browser.
|
||||
ipcMain.on('ELECTRON_NAVIGATION_CONTROLLER', function (event, method, ...args) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
'use strict'
|
||||
|
||||
const {netLog, NetLog} = process.atomBinding('net_log')
|
||||
const { netLog, NetLog } = process.atomBinding('net_log')
|
||||
|
||||
NetLog.prototype.stopLogging = function (callback) {
|
||||
if (callback && typeof callback !== 'function') {
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
'use strict'
|
||||
|
||||
const url = require('url')
|
||||
const {EventEmitter} = require('events')
|
||||
const {Readable} = require('stream')
|
||||
const {app} = require('electron')
|
||||
const {Session} = process.atomBinding('session')
|
||||
const {net, Net} = process.atomBinding('net')
|
||||
const {URLRequest} = net
|
||||
const { EventEmitter } = require('events')
|
||||
const { Readable } = require('stream')
|
||||
const { app } = require('electron')
|
||||
const { Session } = process.atomBinding('session')
|
||||
const { net, Net } = process.atomBinding('net')
|
||||
const { URLRequest } = net
|
||||
|
||||
// Net is an EventEmitter.
|
||||
Object.setPrototypeOf(Net.prototype, EventEmitter.prototype)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
const {EventEmitter} = require('events')
|
||||
const {Notification, isSupported} = process.atomBinding('notification')
|
||||
const { EventEmitter } = require('events')
|
||||
const { Notification, isSupported } = process.atomBinding('notification')
|
||||
|
||||
Object.setPrototypeOf(Notification.prototype, EventEmitter.prototype)
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
const {EventEmitter} = require('events')
|
||||
const {powerMonitor, PowerMonitor} = process.atomBinding('power_monitor')
|
||||
const { EventEmitter } = require('events')
|
||||
const { powerMonitor, PowerMonitor } = process.atomBinding('power_monitor')
|
||||
|
||||
// PowerMonitor is an EventEmitter.
|
||||
Object.setPrototypeOf(PowerMonitor.prototype, EventEmitter.prototype)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
const {app, session} = require('electron')
|
||||
const { app, session } = require('electron')
|
||||
|
||||
// Global protocol APIs.
|
||||
module.exports = process.atomBinding('protocol')
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
const {EventEmitter} = require('events')
|
||||
const {screen, Screen} = process.atomBinding('screen')
|
||||
const { EventEmitter } = require('events')
|
||||
const { screen, Screen } = process.atomBinding('screen')
|
||||
|
||||
// Screen is an EventEmitter.
|
||||
Object.setPrototypeOf(Screen.prototype, EventEmitter.prototype)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
const {EventEmitter} = require('events')
|
||||
const {app} = require('electron')
|
||||
const {fromPartition, Session, Cookies} = process.atomBinding('session')
|
||||
const { EventEmitter } = require('events')
|
||||
const { app } = require('electron')
|
||||
const { fromPartition, Session, Cookies } = process.atomBinding('session')
|
||||
|
||||
// Public API.
|
||||
Object.defineProperties(exports, {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
const {EventEmitter} = require('events')
|
||||
const {systemPreferences, SystemPreferences} = process.atomBinding('system_preferences')
|
||||
const { EventEmitter } = require('events')
|
||||
const { systemPreferences, SystemPreferences } = process.atomBinding('system_preferences')
|
||||
|
||||
// SystemPreferences is an EventEmitter.
|
||||
Object.setPrototypeOf(SystemPreferences.prototype, EventEmitter.prototype)
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
|
||||
const electron = require('electron')
|
||||
|
||||
const {View} = electron
|
||||
const {TextField} = process.atomBinding('text_field')
|
||||
const { View } = electron
|
||||
const { TextField } = process.atomBinding('text_field')
|
||||
|
||||
Object.setPrototypeOf(TextField.prototype, View.prototype)
|
||||
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
'use strict'
|
||||
|
||||
const electron = require('electron')
|
||||
const {EventEmitter} = require('events')
|
||||
const {TopLevelWindow} = process.atomBinding('top_level_window')
|
||||
const { EventEmitter } = require('events')
|
||||
const { TopLevelWindow } = process.atomBinding('top_level_window')
|
||||
|
||||
Object.setPrototypeOf(TopLevelWindow.prototype, EventEmitter.prototype)
|
||||
|
||||
TopLevelWindow.prototype._init = function () {
|
||||
// Avoid recursive require.
|
||||
const {app} = electron
|
||||
const { app } = electron
|
||||
|
||||
// Simulate the application menu on platforms other than macOS.
|
||||
if (process.platform !== 'darwin') {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
const {EventEmitter} = require('events')
|
||||
const { EventEmitter } = require('events')
|
||||
|
||||
let nextItemID = 1
|
||||
|
||||
|
@ -27,7 +27,7 @@ class TouchBar extends EventEmitter {
|
|||
throw new Error('Must specify options object as first argument')
|
||||
}
|
||||
|
||||
let {items, escapeItem} = options
|
||||
let { items, escapeItem } = options
|
||||
|
||||
// FIXME Support array as first argument, remove in 2.0
|
||||
if (Array.isArray(options)) {
|
||||
|
@ -83,7 +83,7 @@ class TouchBar extends EventEmitter {
|
|||
}
|
||||
|
||||
_addToWindow (window) {
|
||||
const {id} = window
|
||||
const { id } = window
|
||||
|
||||
// Already added to window
|
||||
if (this.windowListeners.hasOwnProperty(id)) return
|
||||
|
@ -195,7 +195,7 @@ TouchBar.TouchBarButton = class TouchBarButton extends TouchBarItem {
|
|||
super()
|
||||
if (config == null) config = {}
|
||||
this._addImmutableProperty('type', 'button')
|
||||
const {click, icon, iconPosition, label, backgroundColor} = config
|
||||
const { click, icon, iconPosition, label, backgroundColor } = config
|
||||
this._addLiveProperty('label', label)
|
||||
this._addLiveProperty('backgroundColor', backgroundColor)
|
||||
this._addLiveProperty('icon', icon)
|
||||
|
@ -213,7 +213,7 @@ TouchBar.TouchBarColorPicker = class TouchBarColorPicker extends TouchBarItem {
|
|||
super()
|
||||
if (config == null) config = {}
|
||||
this._addImmutableProperty('type', 'colorpicker')
|
||||
const {availableColors, change, selectedColor} = config
|
||||
const { availableColors, change, selectedColor } = config
|
||||
this._addLiveProperty('availableColors', availableColors)
|
||||
this._addLiveProperty('selectedColor', selectedColor)
|
||||
|
||||
|
@ -266,7 +266,7 @@ TouchBar.TouchBarSlider = class TouchBarSlider extends TouchBarItem {
|
|||
super()
|
||||
if (config == null) config = {}
|
||||
this._addImmutableProperty('type', 'slider')
|
||||
const {change, label, minValue, maxValue, value} = config
|
||||
const { change, label, minValue, maxValue, value } = config
|
||||
this._addLiveProperty('label', label)
|
||||
this._addLiveProperty('minValue', minValue)
|
||||
this._addLiveProperty('maxValue', maxValue)
|
||||
|
@ -294,7 +294,7 @@ TouchBar.TouchBarSegmentedControl = class TouchBarSegmentedControl extends Touch
|
|||
constructor (config) {
|
||||
super()
|
||||
if (config == null) config = {}
|
||||
const {segmentStyle, segments, selectedIndex, change, mode} = config
|
||||
const { segmentStyle, segments, selectedIndex, change, mode } = config
|
||||
this._addImmutableProperty('type', 'segmented_control')
|
||||
this._addLiveProperty('segmentStyle', segmentStyle)
|
||||
this._addLiveProperty('segments', segments || [])
|
||||
|
@ -314,8 +314,8 @@ TouchBar.TouchBarScrubber = class TouchBarScrubber extends TouchBarItem {
|
|||
constructor (config) {
|
||||
super()
|
||||
if (config == null) config = {}
|
||||
const {items, selectedStyle, overlayStyle, showArrowButtons, continuous, mode} = config
|
||||
let {select, highlight} = config
|
||||
const { items, selectedStyle, overlayStyle, showArrowButtons, continuous, mode } = config
|
||||
let { select, highlight } = config
|
||||
this._addImmutableProperty('type', 'scrubber')
|
||||
this._addLiveProperty('items', items)
|
||||
this._addLiveProperty('selectedStyle', selectedStyle || null)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
const {EventEmitter} = require('events')
|
||||
const {Tray} = process.atomBinding('tray')
|
||||
const { EventEmitter } = require('events')
|
||||
const { Tray } = process.atomBinding('tray')
|
||||
|
||||
Object.setPrototypeOf(Tray.prototype, EventEmitter.prototype)
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
'use strict'
|
||||
|
||||
const {EventEmitter} = require('events')
|
||||
const {View} = process.atomBinding('view')
|
||||
const { EventEmitter } = require('events')
|
||||
const { View } = process.atomBinding('view')
|
||||
|
||||
Object.setPrototypeOf(View.prototype, EventEmitter.prototype)
|
||||
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
|
||||
const electron = require('electron')
|
||||
|
||||
const {View} = electron
|
||||
const {WebContentsView} = process.atomBinding('web_contents_view')
|
||||
const { View } = electron
|
||||
const { WebContentsView } = process.atomBinding('web_contents_view')
|
||||
|
||||
Object.setPrototypeOf(WebContentsView.prototype, View.prototype)
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
'use strict'
|
||||
|
||||
const {EventEmitter} = require('events')
|
||||
const { EventEmitter } = require('events')
|
||||
const electron = require('electron')
|
||||
const path = require('path')
|
||||
const url = require('url')
|
||||
const {app, ipcMain, session, NavigationController, deprecate} = electron
|
||||
const { app, ipcMain, session, NavigationController, deprecate } = electron
|
||||
|
||||
const errorUtils = require('../../common/error-utils')
|
||||
|
||||
|
@ -90,7 +90,7 @@ const defaultPrintingSetting = {
|
|||
|
||||
// JavaScript implementations of WebContents.
|
||||
const binding = process.atomBinding('web_contents')
|
||||
const {WebContents} = binding
|
||||
const { WebContents } = binding
|
||||
|
||||
Object.setPrototypeOf(NavigationController.prototype, EventEmitter.prototype)
|
||||
Object.setPrototypeOf(WebContents.prototype, NavigationController.prototype)
|
||||
|
@ -216,7 +216,7 @@ WebContents.prototype.loadFile = function (filePath, options = {}) {
|
|||
if (typeof filePath !== 'string') {
|
||||
throw new Error('Must pass filePath as a string')
|
||||
}
|
||||
const {query, search, hash} = options
|
||||
const { query, search, hash } = options
|
||||
|
||||
return this.loadURL(url.format({
|
||||
protocol: 'file',
|
||||
|
@ -285,7 +285,7 @@ WebContents.prototype._init = function () {
|
|||
}
|
||||
|
||||
// JavaScript wrapper of Debugger.
|
||||
const {Debugger} = process.atomBinding('debugger')
|
||||
const { Debugger } = process.atomBinding('debugger')
|
||||
|
||||
Object.setPrototypeOf(Debugger.prototype, EventEmitter.prototype)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue