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)
|
||||
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
const {app, ipcMain, webContents, BrowserWindow} = require('electron')
|
||||
const {getAllWebContents} = process.atomBinding('web_contents')
|
||||
const { app, ipcMain, webContents, BrowserWindow } = require('electron')
|
||||
const { getAllWebContents } = process.atomBinding('web_contents')
|
||||
const renderProcessPreferences = process.atomBinding('render_process_preferences').forAllWebContents()
|
||||
|
||||
const {Buffer} = require('buffer')
|
||||
const { Buffer } = require('buffer')
|
||||
const fs = require('fs')
|
||||
const path = require('path')
|
||||
const url = require('url')
|
||||
|
||||
// Mapping between extensionId(hostname) and manifest.
|
||||
const manifestMap = {} // extensionId => manifest
|
||||
const manifestNameMap = {} // name => manifest
|
||||
const manifestMap = {} // extensionId => manifest
|
||||
const manifestNameMap = {} // name => manifest
|
||||
const devToolsExtensionNames = new Set()
|
||||
|
||||
const generateExtensionIdFromName = function (name) {
|
||||
|
@ -154,7 +154,7 @@ ipcMain.on('CHROME_RUNTIME_CONNECT', function (event, extensionId, connectInfo)
|
|||
}
|
||||
|
||||
const portId = ++nextId
|
||||
event.returnValue = {tabId: page.webContents.id, portId: portId}
|
||||
event.returnValue = { tabId: page.webContents.id, portId: portId }
|
||||
|
||||
event.sender.once('render-view-deleted', () => {
|
||||
if (page.webContents.isDestroyed()) return
|
||||
|
@ -318,7 +318,7 @@ const chromeExtensionHandler = function (request, callback) {
|
|||
if (err) {
|
||||
// Disabled due to false positive in StandardJS
|
||||
// eslint-disable-next-line standard/no-callback-literal
|
||||
return callback(-6) // FILE_NOT_FOUND
|
||||
return callback(-6) // FILE_NOT_FOUND
|
||||
} else {
|
||||
return callback(content)
|
||||
}
|
||||
|
@ -399,7 +399,7 @@ app.once('ready', function () {
|
|||
const extensions = {}
|
||||
Object.keys(manifestNameMap).forEach(function (name) {
|
||||
const manifest = manifestNameMap[name]
|
||||
extensions[name] = {name: manifest.name, version: manifest.version}
|
||||
extensions[name] = { name: manifest.name, version: manifest.version }
|
||||
})
|
||||
return extensions
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
'use strict'
|
||||
|
||||
const {ipcMain} = require('electron')
|
||||
const {desktopCapturer} = process.atomBinding('desktop_capturer')
|
||||
const { ipcMain } = require('electron')
|
||||
const { desktopCapturer } = process.atomBinding('desktop_capturer')
|
||||
|
||||
const deepEqual = (a, b) => JSON.stringify(a) === JSON.stringify(b)
|
||||
|
||||
|
@ -65,7 +65,7 @@ desktopCapturer.emit = (event, name, sources) => {
|
|||
|
||||
// If the requestsQueue is not empty, start a new request handling.
|
||||
if (requestsQueue.length > 0) {
|
||||
const {captureWindow, captureScreen, thumbnailSize} = requestsQueue[0].options
|
||||
const { captureWindow, captureScreen, thumbnailSize } = requestsQueue[0].options
|
||||
return desktopCapturer.startHandling(captureWindow, captureScreen, thumbnailSize)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
'use strict'
|
||||
|
||||
const {ipcMain, webContents} = require('electron')
|
||||
const { ipcMain, webContents } = require('electron')
|
||||
const parseFeaturesString = require('../common/parse-features-string')
|
||||
|
||||
// Doesn't exist in early initialization.
|
||||
|
@ -191,7 +191,7 @@ const attachGuest = function (event, embedderFrameId, elementInstanceId, guestIn
|
|||
if (!guestInstance) {
|
||||
return
|
||||
}
|
||||
const {guest} = guestInstance
|
||||
const { guest } = guestInstance
|
||||
|
||||
// If this guest is already attached to an element then remove it
|
||||
if (guestInstance.elementInstanceId) {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
'use strict'
|
||||
|
||||
const {BrowserWindow, ipcMain, webContents} = require('electron')
|
||||
const {isSameOrigin} = process.atomBinding('v8_util')
|
||||
const { BrowserWindow, ipcMain, webContents } = require('electron')
|
||||
const { isSameOrigin } = process.atomBinding('v8_util')
|
||||
const parseFeaturesString = require('../common/parse-features-string')
|
||||
|
||||
const hasProp = {}.hasOwnProperty
|
||||
|
@ -52,7 +52,7 @@ const mergeBrowserWindowOptions = function (embedder, options) {
|
|||
// if parent's visibility is available, that overrides 'show' flag (#12125)
|
||||
const win = BrowserWindow.fromWebContents(embedder.webContents)
|
||||
if (win != null) {
|
||||
parentOptions = {...embedder.browserWindowOptions, show: win.isVisible()}
|
||||
parentOptions = { ...embedder.browserWindowOptions, show: win.isVisible() }
|
||||
}
|
||||
|
||||
// Inherit the original options if it is a BrowserWindow.
|
||||
|
@ -247,16 +247,16 @@ ipcMain.on('ELECTRON_GUEST_WINDOW_MANAGER_WINDOW_OPEN', (event, url, frameName,
|
|||
|
||||
const referrer = { url: '', policy: 'default' }
|
||||
ipcMain.emit('ELECTRON_GUEST_WINDOW_MANAGER_INTERNAL_WINDOW_OPEN', event,
|
||||
url, referrer, frameName, disposition, options, additionalFeatures)
|
||||
url, referrer, frameName, disposition, options, additionalFeatures)
|
||||
})
|
||||
|
||||
// Routed window.open messages with fully parsed options
|
||||
ipcMain.on('ELECTRON_GUEST_WINDOW_MANAGER_INTERNAL_WINDOW_OPEN', function (event, url, referrer,
|
||||
frameName, disposition, options,
|
||||
additionalFeatures, postData) {
|
||||
frameName, disposition, options,
|
||||
additionalFeatures, postData) {
|
||||
options = mergeBrowserWindowOptions(event.sender, options)
|
||||
event.sender.emit('new-window', event, url, frameName, disposition, options, additionalFeatures, referrer)
|
||||
const {newGuest} = event
|
||||
const { newGuest } = event
|
||||
if ((event.sender.isGuest() && !event.sender.allowPopups) || event.defaultPrevented) {
|
||||
if (newGuest != null) {
|
||||
if (options.webContents === newGuest.webContents) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
'use strict'
|
||||
|
||||
const {Buffer} = require('buffer')
|
||||
const { Buffer } = require('buffer')
|
||||
const fs = require('fs')
|
||||
const path = require('path')
|
||||
const util = require('util')
|
||||
|
@ -58,7 +58,7 @@ process.on('uncaughtException', function (error) {
|
|||
})
|
||||
|
||||
// Emit 'exit' event on quit.
|
||||
const {app} = require('electron')
|
||||
const { app } = require('electron')
|
||||
|
||||
app.on('quit', function (event, exitCode) {
|
||||
process.emit('exit', exitCode)
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
'use strict'
|
||||
|
||||
const electron = require('electron')
|
||||
const {EventEmitter} = require('events')
|
||||
const { EventEmitter } = require('events')
|
||||
const fs = require('fs')
|
||||
const v8Util = process.atomBinding('v8_util')
|
||||
|
||||
const {ipcMain, isPromise} = electron
|
||||
const { ipcMain, isPromise } = electron
|
||||
|
||||
const objectsRegistry = require('./objects-registry')
|
||||
const bufferUtils = require('../common/buffer-utils')
|
||||
|
@ -34,7 +34,7 @@ const getObjectMembers = function (object) {
|
|||
// Map properties to descriptors.
|
||||
return names.map((name) => {
|
||||
let descriptor = Object.getOwnPropertyDescriptor(object, name)
|
||||
let member = {name, enumerable: descriptor.enumerable, writable: false}
|
||||
let member = { name, enumerable: descriptor.enumerable, writable: false }
|
||||
if (descriptor.get === undefined && typeof object[name] === 'function') {
|
||||
member.type = 'method'
|
||||
} else {
|
||||
|
@ -190,7 +190,7 @@ const unwrapArgs = function (sender, contextId, args) {
|
|||
let ret = {}
|
||||
Object.defineProperty(ret.constructor, 'name', { value: meta.name })
|
||||
|
||||
for (const {name, value} of meta.members) {
|
||||
for (const { name, value } of meta.members) {
|
||||
ret[name] = metaToValue(value)
|
||||
}
|
||||
return ret
|
||||
|
@ -404,7 +404,7 @@ ipcMain.on('ELECTRON_BROWSER_SANDBOX_LOAD', function (event) {
|
|||
try {
|
||||
preloadSrc = fs.readFileSync(preloadPath).toString()
|
||||
} catch (err) {
|
||||
preloadError = {stack: err ? err.stack : (new Error(`Failed to load "${preloadPath}"`)).stack}
|
||||
preloadError = { stack: err ? err.stack : (new Error(`Failed to load "${preloadPath}"`)).stack }
|
||||
}
|
||||
}
|
||||
event.returnValue = {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue