Summary:
Started with upgrading electron from 3.0.0 to 4.0.5. This required a bunch of subsequent updates:
* upgrading `electron-builder` to latest version, because the old version couldn't build electron 4 apps.
* `appDir` is deprecated in builder config, `projectDir` is used instead, which we already had set, so its fine to just remove this ([see GitHub commit](a5e457163e)).
* upgrading `jest-runner/electron` because the old version couldn't run electron 4 tests.
* upgrading our custom dependency resolution to use electron 4.0.5, because the test runner still resolves to 2.0.8 ([see GitHub issue](https://github.com/facebook-atom/jest-electron-runner/issues/31)).
* updating `sandcastle.sh` to use the new cache files from D14131344.
* removing `package-lock.json` as is was causing warnings. We use `yarn` and `yarn.lock` anyways. This file must have been committed by accident.
* updating our check to only run one version of Flipper at a time to use the new electron API `app.requestSingleInstanceLock` as the old one was removed in electron 4.
* updating the snapshot test that checks App rendering, which changed a little due to the electron upgrade.
* upgrading flow-type definitions to `electron-v4.0.5.js` generated by [electron-flowtype-definitions](https://github.com/danielbuechele/electron-flowtype-definitions).
**PS: Best new feature in Electron 4: Copy&paste working in dev tools**
Reviewed By: jknoxville
Differential Revision: D14131360
fbshipit-source-id: d7ed9643875629a1fa1860bb61b11dd0c64112ab
4050 lines
125 KiB
JavaScript
4050 lines
125 KiB
JavaScript
/**
|
|
* Copyright 2018-present Facebook.
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
* @format
|
|
* @flow
|
|
*
|
|
* This is an autogenerated libdef for: electron-v4.0.5 renderer process
|
|
*/
|
|
|
|
declare module 'electron' {
|
|
declare module.exports: {
|
|
clipboard: {
|
|
readText: (type?: ?string) => string,
|
|
writeText: (text: string, type?: ?string) => void,
|
|
readHTML: (type?: ?string) => string,
|
|
writeHTML: (markup: string, type?: ?string) => void,
|
|
readImage: (type?: ?string) => NativeImage,
|
|
writeImage: (image: NativeImage, type?: ?string) => void,
|
|
readRTF: (type?: ?string) => string,
|
|
writeRTF: (text: string, type?: ?string) => void,
|
|
readBookmark: () => {
|
|
title: string,
|
|
url: string,
|
|
},
|
|
writeBookmark: (title: string, url: string, type?: ?string) => void,
|
|
readFindText: () => string,
|
|
writeFindText: (text: string) => void,
|
|
clear: (type?: ?string) => void,
|
|
availableFormats: (type?: ?string) => Array<string>,
|
|
has: (format: string, type?: ?string) => boolean,
|
|
read: (format: string) => string,
|
|
readBuffer: (format: string) => Buffer,
|
|
writeBuffer: (format: string, buffer: Buffer, type?: ?string) => void,
|
|
write: (
|
|
data: {
|
|
text?: ?string,
|
|
html?: ?string,
|
|
image?: ?NativeImage,
|
|
rtf?: ?string,
|
|
bookmark?: ?string,
|
|
},
|
|
type?: ?string,
|
|
) => void,
|
|
},
|
|
crashReporter: {
|
|
start: (options: {
|
|
companyName: string,
|
|
submitURL: string,
|
|
productName?: ?string,
|
|
uploadToServer?: ?boolean,
|
|
ignoreSystemCrashHandler?: ?boolean,
|
|
extra?: ?{},
|
|
crashesDirectory?: ?string,
|
|
}) => void,
|
|
getLastCrashReport: () => CrashReport,
|
|
getUploadedReports: () => Array<CrashReport>,
|
|
getUploadToServer: () => boolean,
|
|
setUploadToServer: (uploadToServer: boolean) => void,
|
|
addExtraParameter: (key: string, value: string) => void,
|
|
removeExtraParameter: (key: string) => void,
|
|
getParameters: () => void,
|
|
},
|
|
desktopCapturer: {
|
|
getSources: (
|
|
options: {
|
|
types: Array<string>,
|
|
thumbnailSize?: ?Size,
|
|
},
|
|
callback: Function,
|
|
) => void,
|
|
},
|
|
ipcRenderer: {
|
|
on: (channel: string, listener: Function) => void,
|
|
once: (channel: string, listener: Function) => void,
|
|
removeListener: (channel: string, listener: Function) => void,
|
|
removeAllListeners: (channel: string) => void,
|
|
send: (channel: string, ...args: Array<any>) => void,
|
|
sendSync: (channel: string, ...args: Array<any>) => any,
|
|
sendTo: (
|
|
webContentsId: number,
|
|
channel: string,
|
|
...args: Array<any>
|
|
) => void,
|
|
sendToHost: (channel: string, ...args: Array<any>) => void,
|
|
},
|
|
nativeImage: {
|
|
createEmpty: () => NativeImage,
|
|
createFromPath: (path: string) => NativeImage,
|
|
createFromBuffer: (
|
|
buffer: Buffer,
|
|
options?: ?{
|
|
width?: ?number,
|
|
height?: ?number,
|
|
scaleFactor?: ?number,
|
|
},
|
|
) => NativeImage,
|
|
createFromDataURL: (dataURL: string) => NativeImage,
|
|
createFromNamedImage: (
|
|
imageName: string,
|
|
hslShift: Array<number>,
|
|
) => NativeImage,
|
|
},
|
|
process: {
|
|
crash: () => void,
|
|
getCreationTime: () => number | null,
|
|
getCPUUsage: () => CPUUsage,
|
|
getIOCounters: () => IOCounters,
|
|
getHeapStatistics: () => {
|
|
totalHeapSize: number,
|
|
totalHeapSizeExecutable: number,
|
|
totalPhysicalSize: number,
|
|
totalAvailableSize: number,
|
|
usedHeapSize: number,
|
|
heapSizeLimit: number,
|
|
mallocedMemory: number,
|
|
peakMallocedMemory: number,
|
|
doesZapGarbage: boolean,
|
|
},
|
|
getProcessMemoryInfo: () => {
|
|
residentSet: number,
|
|
private: number,
|
|
shared: number,
|
|
},
|
|
getSystemMemoryInfo: () => {
|
|
total: number,
|
|
free: number,
|
|
swapTotal: number,
|
|
swapFree: number,
|
|
},
|
|
takeHeapSnapshot: (filePath: string) => boolean,
|
|
hang: () => void,
|
|
setFdLimit: (maxDescriptors: number) => void,
|
|
on: (eventName: 'loaded', callback: () => void) => void,
|
|
once: (eventName: 'loaded', callback: () => void) => void,
|
|
defaultApp?: ?boolean,
|
|
mas?: ?boolean,
|
|
noAsar?: ?boolean,
|
|
noDeprecation?: ?boolean,
|
|
resourcesPath?: ?string,
|
|
sandboxed?: ?boolean,
|
|
throwDeprecation?: ?boolean,
|
|
traceDeprecation?: ?boolean,
|
|
traceProcessWarnings?: ?boolean,
|
|
type?: ?string,
|
|
windowsStore?: ?boolean,
|
|
versions: {
|
|
chrome?: ?string,
|
|
electron?: ?string,
|
|
},
|
|
},
|
|
remote: {
|
|
require: (module: string) => any,
|
|
getCurrentWindow: () => BrowserWindow,
|
|
getCurrentWebContents: () => WebContents,
|
|
getGlobal: (name: string) => any,
|
|
process?: ?any,
|
|
app: {
|
|
quit: () => void,
|
|
exit: (exitCode?: ?number) => void,
|
|
relaunch: (
|
|
options?: ?{
|
|
args?: ?Array<string>,
|
|
execPath?: ?string,
|
|
},
|
|
) => void,
|
|
isReady: () => boolean,
|
|
whenReady: () => Promise<any>,
|
|
focus: () => void,
|
|
hide: () => void,
|
|
show: () => void,
|
|
getAppPath: () => string,
|
|
getPath: (name: string) => string,
|
|
getFileIcon: (
|
|
path: string,
|
|
options?: ?{
|
|
size: 'small' | 'normal' | 'large',
|
|
},
|
|
callback: Function,
|
|
) => void,
|
|
setPath: (name: string, path: string) => void,
|
|
getVersion: () => string,
|
|
getName: () => string,
|
|
setName: (name: string) => void,
|
|
getLocale: () => string,
|
|
addRecentDocument: (path: string) => void,
|
|
clearRecentDocuments: () => void,
|
|
setAsDefaultProtocolClient: (
|
|
protocol: string,
|
|
path?: ?string,
|
|
args?: ?Array<string>,
|
|
) => boolean,
|
|
removeAsDefaultProtocolClient: (
|
|
protocol: string,
|
|
path?: ?string,
|
|
args?: ?Array<string>,
|
|
) => boolean,
|
|
isDefaultProtocolClient: (
|
|
protocol: string,
|
|
path?: ?string,
|
|
args?: ?Array<string>,
|
|
) => boolean,
|
|
setUserTasks: (tasks: Array<Task>) => boolean,
|
|
getJumpListSettings: () => {
|
|
minItems: number,
|
|
removedItems: Array<JumpListItem>,
|
|
},
|
|
setJumpList: (categories: Array<JumpListCategory>) => void,
|
|
requestSingleInstanceLock: () => boolean,
|
|
hasSingleInstanceLock: () => boolean,
|
|
releaseSingleInstanceLock: () => void,
|
|
setUserActivity: (
|
|
type: string,
|
|
userInfo: {},
|
|
webpageURL?: ?string,
|
|
) => void,
|
|
getCurrentActivityType: () => string,
|
|
invalidateCurrentActivity: (type: string) => void,
|
|
updateCurrentActivity: (type: string, userInfo: {}) => void,
|
|
setAppUserModelId: (id: string) => void,
|
|
importCertificate: (
|
|
options: {
|
|
certificate: string,
|
|
password: string,
|
|
},
|
|
callback: Function,
|
|
) => void,
|
|
disableHardwareAcceleration: () => void,
|
|
disableDomainBlockingFor3DAPIs: () => void,
|
|
getAppMetrics: () => Array<ProcessMetric>,
|
|
getGPUFeatureStatus: () => GPUFeatureStatus,
|
|
getGPUInfo: (infoType: string) => Promise<any>,
|
|
setBadgeCount: (count: number) => boolean,
|
|
getBadgeCount: () => number,
|
|
isUnityRunning: () => boolean,
|
|
getLoginItemSettings: (
|
|
options?: ?{
|
|
path?: ?string,
|
|
args?: ?Array<string>,
|
|
},
|
|
) => {
|
|
options?: ?{
|
|
path?: ?string,
|
|
args?: ?Array<string>,
|
|
},
|
|
openAtLogin: boolean,
|
|
openAsHidden: boolean,
|
|
wasOpenedAtLogin: boolean,
|
|
wasOpenedAsHidden: boolean,
|
|
restoreState: boolean,
|
|
},
|
|
setLoginItemSettings: (settings: {
|
|
openAtLogin?: ?boolean,
|
|
openAsHidden?: ?boolean,
|
|
path?: ?string,
|
|
args?: ?Array<string>,
|
|
}) => void,
|
|
isAccessibilitySupportEnabled: () => boolean,
|
|
setAccessibilitySupportEnabled: (enabled: boolean) => void,
|
|
showAboutPanel: () => void,
|
|
setAboutPanelOptions: (options: {
|
|
applicationName?: ?string,
|
|
applicationVersion?: ?string,
|
|
copyright?: ?string,
|
|
credits?: ?string,
|
|
version?: ?string,
|
|
}) => void,
|
|
startAccessingSecurityScopedResource: (
|
|
bookmarkData: string,
|
|
) => Function,
|
|
enableSandbox: () => void,
|
|
enableMixedSandbox: () => void,
|
|
isInApplicationsFolder: () => boolean,
|
|
moveToApplicationsFolder: () => boolean,
|
|
on: ((
|
|
eventName: 'will-finish-launching',
|
|
callback: () => void,
|
|
) => void) &
|
|
((eventName: 'ready', callback: (launchInfo: {}) => void) => void) &
|
|
((eventName: 'window-all-closed', callback: () => void) => void) &
|
|
((
|
|
eventName: 'before-quit',
|
|
callback: (event: Event) => void,
|
|
) => void) &
|
|
((eventName: 'will-quit', callback: (event: Event) => void) => void) &
|
|
((
|
|
eventName: 'quit',
|
|
callback: (event: Event, exitCode: number) => void,
|
|
) => void) &
|
|
((
|
|
eventName: 'open-file',
|
|
callback: (event: Event, path: string) => void,
|
|
) => void) &
|
|
((
|
|
eventName: 'open-url',
|
|
callback: (event: Event, url: string) => void,
|
|
) => void) &
|
|
((
|
|
eventName: 'activate',
|
|
callback: (event: Event, hasVisibleWindows: boolean) => void,
|
|
) => void) &
|
|
((
|
|
eventName: 'continue-activity',
|
|
callback: (event: Event, type: string, userInfo: {}) => void,
|
|
) => void) &
|
|
((
|
|
eventName: 'will-continue-activity',
|
|
callback: (event: Event, type: string) => void,
|
|
) => void) &
|
|
((
|
|
eventName: 'continue-activity-error',
|
|
callback: (event: Event, type: string, error: string) => void,
|
|
) => void) &
|
|
((
|
|
eventName: 'activity-was-continued',
|
|
callback: (event: Event, type: string, userInfo: {}) => void,
|
|
) => void) &
|
|
((
|
|
eventName: 'update-activity-state',
|
|
callback: (event: Event, type: string, userInfo: {}) => void,
|
|
) => void) &
|
|
((
|
|
eventName: 'new-window-for-tab',
|
|
callback: (event: Event) => void,
|
|
) => void) &
|
|
((
|
|
eventName: 'browser-window-blur',
|
|
callback: (event: Event, window: BrowserWindow) => void,
|
|
) => void) &
|
|
((
|
|
eventName: 'browser-window-focus',
|
|
callback: (event: Event, window: BrowserWindow) => void,
|
|
) => void) &
|
|
((
|
|
eventName: 'browser-window-created',
|
|
callback: (event: Event, window: BrowserWindow) => void,
|
|
) => void) &
|
|
((
|
|
eventName: 'web-contents-created',
|
|
callback: (event: Event, webContents: WebContents) => void,
|
|
) => void) &
|
|
((
|
|
eventName: 'certificate-error',
|
|
callback: (
|
|
event: Event,
|
|
webContents: WebContents,
|
|
url: string,
|
|
error: string,
|
|
certificate: Certificate,
|
|
callback: Function,
|
|
) => void,
|
|
) => void) &
|
|
((
|
|
eventName: 'select-client-certificate',
|
|
callback: (
|
|
event: Event,
|
|
webContents: WebContents,
|
|
url: URL,
|
|
certificateList: Array<Certificate>,
|
|
callback: Function,
|
|
) => void,
|
|
) => void) &
|
|
((
|
|
eventName: 'login',
|
|
callback: (
|
|
event: Event,
|
|
webContents: WebContents,
|
|
request: {
|
|
method: string,
|
|
url: URL,
|
|
referrer: URL,
|
|
},
|
|
authInfo: {
|
|
isProxy: boolean,
|
|
scheme: string,
|
|
host: string,
|
|
port: number,
|
|
realm: string,
|
|
},
|
|
callback: Function,
|
|
) => void,
|
|
) => void) &
|
|
((
|
|
eventName: 'gpu-process-crashed',
|
|
callback: (event: Event, killed: boolean) => void,
|
|
) => void) &
|
|
((
|
|
eventName: 'accessibility-support-changed',
|
|
callback: (
|
|
event: Event,
|
|
accessibilitySupportEnabled: boolean,
|
|
) => void,
|
|
) => void) &
|
|
((
|
|
eventName: 'session-created',
|
|
callback: (session: Session) => void,
|
|
) => void) &
|
|
((
|
|
eventName: 'second-instance',
|
|
callback: (
|
|
event: Event,
|
|
argv: Array<string>,
|
|
workingDirectory: string,
|
|
) => void,
|
|
) => void) &
|
|
((
|
|
eventName: 'remote-require',
|
|
callback: (
|
|
event: Event,
|
|
webContents: WebContents,
|
|
moduleName: string,
|
|
) => void,
|
|
) => void) &
|
|
((
|
|
eventName: 'remote-get-global',
|
|
callback: (
|
|
event: Event,
|
|
webContents: WebContents,
|
|
globalName: string,
|
|
) => void,
|
|
) => void) &
|
|
((
|
|
eventName: 'remote-get-builtin',
|
|
callback: (
|
|
event: Event,
|
|
webContents: WebContents,
|
|
moduleName: string,
|
|
) => void,
|
|
) => void) &
|
|
((
|
|
eventName: 'remote-get-current-window',
|
|
callback: (event: Event, webContents: WebContents) => void,
|
|
) => void) &
|
|
((
|
|
eventName: 'remote-get-current-web-contents',
|
|
callback: (event: Event, webContents: WebContents) => void,
|
|
) => void) &
|
|
((
|
|
eventName: 'remote-get-guest-web-contents',
|
|
callback: (
|
|
event: Event,
|
|
webContents: WebContents,
|
|
guestWebContents: WebContents,
|
|
) => void,
|
|
) => void),
|
|
once: ((
|
|
eventName: 'will-finish-launching',
|
|
callback: () => void,
|
|
) => void) &
|
|
((eventName: 'ready', callback: (launchInfo: {}) => void) => void) &
|
|
((eventName: 'window-all-closed', callback: () => void) => void) &
|
|
((
|
|
eventName: 'before-quit',
|
|
callback: (event: Event) => void,
|
|
) => void) &
|
|
((eventName: 'will-quit', callback: (event: Event) => void) => void) &
|
|
((
|
|
eventName: 'quit',
|
|
callback: (event: Event, exitCode: number) => void,
|
|
) => void) &
|
|
((
|
|
eventName: 'open-file',
|
|
callback: (event: Event, path: string) => void,
|
|
) => void) &
|
|
((
|
|
eventName: 'open-url',
|
|
callback: (event: Event, url: string) => void,
|
|
) => void) &
|
|
((
|
|
eventName: 'activate',
|
|
callback: (event: Event, hasVisibleWindows: boolean) => void,
|
|
) => void) &
|
|
((
|
|
eventName: 'continue-activity',
|
|
callback: (event: Event, type: string, userInfo: {}) => void,
|
|
) => void) &
|
|
((
|
|
eventName: 'will-continue-activity',
|
|
callback: (event: Event, type: string) => void,
|
|
) => void) &
|
|
((
|
|
eventName: 'continue-activity-error',
|
|
callback: (event: Event, type: string, error: string) => void,
|
|
) => void) &
|
|
((
|
|
eventName: 'activity-was-continued',
|
|
callback: (event: Event, type: string, userInfo: {}) => void,
|
|
) => void) &
|
|
((
|
|
eventName: 'update-activity-state',
|
|
callback: (event: Event, type: string, userInfo: {}) => void,
|
|
) => void) &
|
|
((
|
|
eventName: 'new-window-for-tab',
|
|
callback: (event: Event) => void,
|
|
) => void) &
|
|
((
|
|
eventName: 'browser-window-blur',
|
|
callback: (event: Event, window: BrowserWindow) => void,
|
|
) => void) &
|
|
((
|
|
eventName: 'browser-window-focus',
|
|
callback: (event: Event, window: BrowserWindow) => void,
|
|
) => void) &
|
|
((
|
|
eventName: 'browser-window-created',
|
|
callback: (event: Event, window: BrowserWindow) => void,
|
|
) => void) &
|
|
((
|
|
eventName: 'web-contents-created',
|
|
callback: (event: Event, webContents: WebContents) => void,
|
|
) => void) &
|
|
((
|
|
eventName: 'certificate-error',
|
|
callback: (
|
|
event: Event,
|
|
webContents: WebContents,
|
|
url: string,
|
|
error: string,
|
|
certificate: Certificate,
|
|
callback: Function,
|
|
) => void,
|
|
) => void) &
|
|
((
|
|
eventName: 'select-client-certificate',
|
|
callback: (
|
|
event: Event,
|
|
webContents: WebContents,
|
|
url: URL,
|
|
certificateList: Array<Certificate>,
|
|
callback: Function,
|
|
) => void,
|
|
) => void) &
|
|
((
|
|
eventName: 'login',
|
|
callback: (
|
|
event: Event,
|
|
webContents: WebContents,
|
|
request: {
|
|
method: string,
|
|
url: URL,
|
|
referrer: URL,
|
|
},
|
|
authInfo: {
|
|
isProxy: boolean,
|
|
scheme: string,
|
|
host: string,
|
|
port: number,
|
|
realm: string,
|
|
},
|
|
callback: Function,
|
|
) => void,
|
|
) => void) &
|
|
((
|
|
eventName: 'gpu-process-crashed',
|
|
callback: (event: Event, killed: boolean) => void,
|
|
) => void) &
|
|
((
|
|
eventName: 'accessibility-support-changed',
|
|
callback: (
|
|
event: Event,
|
|
accessibilitySupportEnabled: boolean,
|
|
) => void,
|
|
) => void) &
|
|
((
|
|
eventName: 'session-created',
|
|
callback: (session: Session) => void,
|
|
) => void) &
|
|
((
|
|
eventName: 'second-instance',
|
|
callback: (
|
|
event: Event,
|
|
argv: Array<string>,
|
|
workingDirectory: string,
|
|
) => void,
|
|
) => void) &
|
|
((
|
|
eventName: 'remote-require',
|
|
callback: (
|
|
event: Event,
|
|
webContents: WebContents,
|
|
moduleName: string,
|
|
) => void,
|
|
) => void) &
|
|
((
|
|
eventName: 'remote-get-global',
|
|
callback: (
|
|
event: Event,
|
|
webContents: WebContents,
|
|
globalName: string,
|
|
) => void,
|
|
) => void) &
|
|
((
|
|
eventName: 'remote-get-builtin',
|
|
callback: (
|
|
event: Event,
|
|
webContents: WebContents,
|
|
moduleName: string,
|
|
) => void,
|
|
) => void) &
|
|
((
|
|
eventName: 'remote-get-current-window',
|
|
callback: (event: Event, webContents: WebContents) => void,
|
|
) => void) &
|
|
((
|
|
eventName: 'remote-get-current-web-contents',
|
|
callback: (event: Event, webContents: WebContents) => void,
|
|
) => void) &
|
|
((
|
|
eventName: 'remote-get-guest-web-contents',
|
|
callback: (
|
|
event: Event,
|
|
webContents: WebContents,
|
|
guestWebContents: WebContents,
|
|
) => void,
|
|
) => void),
|
|
isPackaged?: ?boolean,
|
|
commandLine: {
|
|
appendSwitch?: ?Function,
|
|
appendArgument?: ?Function,
|
|
},
|
|
dock: {
|
|
bounce?: ?Function,
|
|
cancelBounce?: ?Function,
|
|
downloadFinished?: ?Function,
|
|
setBadge?: ?Function,
|
|
getBadge?: ?Function,
|
|
hide?: ?Function,
|
|
show?: ?Function,
|
|
isVisible?: ?Function,
|
|
setMenu?: ?Function,
|
|
setIcon?: ?Function,
|
|
},
|
|
},
|
|
autoUpdater: {
|
|
setFeedURL: (options: {
|
|
url: string,
|
|
headers?: ?{},
|
|
serverType?: ?string,
|
|
}) => void,
|
|
getFeedURL: () => string,
|
|
checkForUpdates: () => void,
|
|
quitAndInstall: () => void,
|
|
on: ((eventName: 'error', callback: (error: Error) => void) => void) &
|
|
((eventName: 'checking-for-update', callback: () => void) => void) &
|
|
((eventName: 'update-available', callback: () => void) => void) &
|
|
((eventName: 'update-not-available', callback: () => void) => void) &
|
|
((
|
|
eventName: 'update-downloaded',
|
|
callback: (
|
|
event: Event,
|
|
releaseNotes: string,
|
|
releaseName: string,
|
|
releaseDate: Date,
|
|
updateURL: string,
|
|
) => void,
|
|
) => void) &
|
|
((eventName: 'before-quit-for-update', callback: () => void) => void),
|
|
once: ((eventName: 'error', callback: (error: Error) => void) => void) &
|
|
((eventName: 'checking-for-update', callback: () => void) => void) &
|
|
((eventName: 'update-available', callback: () => void) => void) &
|
|
((eventName: 'update-not-available', callback: () => void) => void) &
|
|
((
|
|
eventName: 'update-downloaded',
|
|
callback: (
|
|
event: Event,
|
|
releaseNotes: string,
|
|
releaseName: string,
|
|
releaseDate: Date,
|
|
updateURL: string,
|
|
) => void,
|
|
) => void) &
|
|
((eventName: 'before-quit-for-update', callback: () => void) => void),
|
|
},
|
|
clipboard: {
|
|
readText: (type?: ?string) => string,
|
|
writeText: (text: string, type?: ?string) => void,
|
|
readHTML: (type?: ?string) => string,
|
|
writeHTML: (markup: string, type?: ?string) => void,
|
|
readImage: (type?: ?string) => NativeImage,
|
|
writeImage: (image: NativeImage, type?: ?string) => void,
|
|
readRTF: (type?: ?string) => string,
|
|
writeRTF: (text: string, type?: ?string) => void,
|
|
readBookmark: () => {
|
|
title: string,
|
|
url: string,
|
|
},
|
|
writeBookmark: (title: string, url: string, type?: ?string) => void,
|
|
readFindText: () => string,
|
|
writeFindText: (text: string) => void,
|
|
clear: (type?: ?string) => void,
|
|
availableFormats: (type?: ?string) => Array<string>,
|
|
has: (format: string, type?: ?string) => boolean,
|
|
read: (format: string) => string,
|
|
readBuffer: (format: string) => Buffer,
|
|
writeBuffer: (format: string, buffer: Buffer, type?: ?string) => void,
|
|
write: (
|
|
data: {
|
|
text?: ?string,
|
|
html?: ?string,
|
|
image?: ?NativeImage,
|
|
rtf?: ?string,
|
|
bookmark?: ?string,
|
|
},
|
|
type?: ?string,
|
|
) => void,
|
|
},
|
|
contentTracing: {
|
|
getCategories: (callback: Function) => void,
|
|
startRecording: (
|
|
options: TraceCategoriesAndOptions | TraceConfig,
|
|
callback: Function,
|
|
) => void,
|
|
stopRecording: (resultFilePath: string, callback: Function) => void,
|
|
startMonitoring: (
|
|
options: {
|
|
categoryFilter: string,
|
|
traceOptions: string,
|
|
},
|
|
callback: Function,
|
|
) => void,
|
|
stopMonitoring: (callback: Function) => void,
|
|
captureMonitoringSnapshot: (
|
|
resultFilePath: string,
|
|
callback: Function,
|
|
) => void,
|
|
getTraceBufferUsage: (callback: Function) => void,
|
|
},
|
|
crashReporter: {
|
|
start: (options: {
|
|
companyName: string,
|
|
submitURL: string,
|
|
productName?: ?string,
|
|
uploadToServer?: ?boolean,
|
|
ignoreSystemCrashHandler?: ?boolean,
|
|
extra?: ?{},
|
|
crashesDirectory?: ?string,
|
|
}) => void,
|
|
getLastCrashReport: () => CrashReport,
|
|
getUploadedReports: () => Array<CrashReport>,
|
|
getUploadToServer: () => boolean,
|
|
setUploadToServer: (uploadToServer: boolean) => void,
|
|
addExtraParameter: (key: string, value: string) => void,
|
|
removeExtraParameter: (key: string) => void,
|
|
getParameters: () => void,
|
|
},
|
|
dialog: {
|
|
showOpenDialog: ((
|
|
browserWindow?: ?BrowserWindow,
|
|
options: {
|
|
title?: ?string,
|
|
defaultPath?: ?string,
|
|
buttonLabel?: ?string,
|
|
filters?: ?Array<FileFilter>,
|
|
properties?: ?Array<
|
|
| 'openFile'
|
|
| 'openDirectory'
|
|
| 'multiSelections'
|
|
| 'showHiddenFiles'
|
|
| 'createDirectory'
|
|
| 'promptToCreate'
|
|
| 'noResolveAliases'
|
|
| 'treatPackageAsDirectory',
|
|
>,
|
|
message?: ?string,
|
|
securityScopedBookmarks?: ?boolean,
|
|
},
|
|
callback?: ?Function,
|
|
) => Array<string>) &
|
|
((
|
|
options: {
|
|
title?: ?string,
|
|
defaultPath?: ?string,
|
|
buttonLabel?: ?string,
|
|
filters?: ?Array<FileFilter>,
|
|
properties?: ?Array<
|
|
| 'openFile'
|
|
| 'openDirectory'
|
|
| 'multiSelections'
|
|
| 'showHiddenFiles'
|
|
| 'createDirectory'
|
|
| 'promptToCreate'
|
|
| 'noResolveAliases'
|
|
| 'treatPackageAsDirectory',
|
|
>,
|
|
message?: ?string,
|
|
securityScopedBookmarks?: ?boolean,
|
|
},
|
|
callback?: ?Function,
|
|
) => Array<string>),
|
|
showSaveDialog: ((
|
|
browserWindow?: ?BrowserWindow,
|
|
options: {
|
|
title?: ?string,
|
|
defaultPath?: ?string,
|
|
buttonLabel?: ?string,
|
|
filters?: ?Array<FileFilter>,
|
|
message?: ?string,
|
|
nameFieldLabel?: ?string,
|
|
showsTagField?: ?boolean,
|
|
securityScopedBookmarks?: ?boolean,
|
|
},
|
|
callback?: ?Function,
|
|
) => string) &
|
|
((
|
|
options: {
|
|
title?: ?string,
|
|
defaultPath?: ?string,
|
|
buttonLabel?: ?string,
|
|
filters?: ?Array<FileFilter>,
|
|
message?: ?string,
|
|
nameFieldLabel?: ?string,
|
|
showsTagField?: ?boolean,
|
|
securityScopedBookmarks?: ?boolean,
|
|
},
|
|
callback?: ?Function,
|
|
) => string),
|
|
showMessageBox: ((
|
|
browserWindow?: ?BrowserWindow,
|
|
options: {
|
|
type?: ?string,
|
|
buttons?: ?Array<string>,
|
|
defaultId?: ?number,
|
|
title?: ?string,
|
|
message: string,
|
|
detail?: ?string,
|
|
checkboxLabel?: ?string,
|
|
checkboxChecked?: ?boolean,
|
|
icon?: ?NativeImage,
|
|
cancelId?: ?number,
|
|
noLink?: ?boolean,
|
|
normalizeAccessKeys?: ?boolean,
|
|
},
|
|
callback?: ?Function,
|
|
) => number) &
|
|
((
|
|
options: {
|
|
type?: ?string,
|
|
buttons?: ?Array<string>,
|
|
defaultId?: ?number,
|
|
title?: ?string,
|
|
message: string,
|
|
detail?: ?string,
|
|
checkboxLabel?: ?string,
|
|
checkboxChecked?: ?boolean,
|
|
icon?: ?NativeImage,
|
|
cancelId?: ?number,
|
|
noLink?: ?boolean,
|
|
normalizeAccessKeys?: ?boolean,
|
|
},
|
|
callback?: ?Function,
|
|
) => number),
|
|
showErrorBox: (title: string, content: string) => void,
|
|
showCertificateTrustDialog: ((
|
|
browserWindow?: ?BrowserWindow,
|
|
options: {
|
|
certificate: Certificate,
|
|
message: string,
|
|
},
|
|
callback: Function,
|
|
) => void) &
|
|
((
|
|
options: {
|
|
certificate: Certificate,
|
|
message: string,
|
|
},
|
|
callback: Function,
|
|
) => void),
|
|
},
|
|
globalShortcut: {
|
|
register: (accelerator: Accelerator, callback: Function) => void,
|
|
isRegistered: (accelerator: Accelerator) => boolean,
|
|
unregister: (accelerator: Accelerator) => void,
|
|
unregisterAll: () => void,
|
|
},
|
|
inAppPurchase: {
|
|
purchaseProduct: (
|
|
productID: string,
|
|
quantity?: ?number,
|
|
callback?: ?Function,
|
|
) => void,
|
|
getProducts: (productIDs: Array<string>, callback: Function) => void,
|
|
canMakePayments: () => boolean,
|
|
getReceiptURL: () => string,
|
|
finishAllTransactions: () => void,
|
|
finishTransactionByDate: (date: string) => void,
|
|
on: (
|
|
eventName: 'transactions-updated',
|
|
callback: (event: Event, transactions: Array<Transaction>) => void,
|
|
) => void,
|
|
once: (
|
|
eventName: 'transactions-updated',
|
|
callback: (event: Event, transactions: Array<Transaction>) => void,
|
|
) => void,
|
|
},
|
|
ipcMain: {
|
|
on: (channel: string, listener: Function) => void,
|
|
once: (channel: string, listener: Function) => void,
|
|
removeListener: (channel: string, listener: Function) => void,
|
|
removeAllListeners: (channel: string) => void,
|
|
},
|
|
nativeImage: {
|
|
createEmpty: () => NativeImage,
|
|
createFromPath: (path: string) => NativeImage,
|
|
createFromBuffer: (
|
|
buffer: Buffer,
|
|
options?: ?{
|
|
width?: ?number,
|
|
height?: ?number,
|
|
scaleFactor?: ?number,
|
|
},
|
|
) => NativeImage,
|
|
createFromDataURL: (dataURL: string) => NativeImage,
|
|
createFromNamedImage: (
|
|
imageName: string,
|
|
hslShift: Array<number>,
|
|
) => NativeImage,
|
|
},
|
|
net: {
|
|
request: (options: Object | string) => ClientRequest,
|
|
},
|
|
netLog: {
|
|
startLogging: (path: string) => void,
|
|
stopLogging: (callback?: ?Function) => void,
|
|
currentlyLogging?: ?boolean,
|
|
currentlyLoggingPath?: ?string,
|
|
},
|
|
powerMonitor: {
|
|
on: ((eventName: 'suspend', callback: () => void) => void) &
|
|
((eventName: 'resume', callback: () => void) => void) &
|
|
((eventName: 'on-ac', callback: () => void) => void) &
|
|
((eventName: 'on-battery', callback: () => void) => void) &
|
|
((eventName: 'shutdown', callback: () => void) => void) &
|
|
((eventName: 'lock-screen', callback: () => void) => void) &
|
|
((eventName: 'unlock-screen', callback: () => void) => void),
|
|
once: ((eventName: 'suspend', callback: () => void) => void) &
|
|
((eventName: 'resume', callback: () => void) => void) &
|
|
((eventName: 'on-ac', callback: () => void) => void) &
|
|
((eventName: 'on-battery', callback: () => void) => void) &
|
|
((eventName: 'shutdown', callback: () => void) => void) &
|
|
((eventName: 'lock-screen', callback: () => void) => void) &
|
|
((eventName: 'unlock-screen', callback: () => void) => void),
|
|
},
|
|
powerSaveBlocker: {
|
|
start: (
|
|
type: 'prevent-app-suspension' | 'prevent-display-sleep',
|
|
) => number,
|
|
stop: (id: number) => void,
|
|
isStarted: (id: number) => boolean,
|
|
},
|
|
process: {
|
|
crash: () => void,
|
|
getCreationTime: () => number | null,
|
|
getCPUUsage: () => CPUUsage,
|
|
getIOCounters: () => IOCounters,
|
|
getHeapStatistics: () => {
|
|
totalHeapSize: number,
|
|
totalHeapSizeExecutable: number,
|
|
totalPhysicalSize: number,
|
|
totalAvailableSize: number,
|
|
usedHeapSize: number,
|
|
heapSizeLimit: number,
|
|
mallocedMemory: number,
|
|
peakMallocedMemory: number,
|
|
doesZapGarbage: boolean,
|
|
},
|
|
getProcessMemoryInfo: () => {
|
|
residentSet: number,
|
|
private: number,
|
|
shared: number,
|
|
},
|
|
getSystemMemoryInfo: () => {
|
|
total: number,
|
|
free: number,
|
|
swapTotal: number,
|
|
swapFree: number,
|
|
},
|
|
takeHeapSnapshot: (filePath: string) => boolean,
|
|
hang: () => void,
|
|
setFdLimit: (maxDescriptors: number) => void,
|
|
on: (eventName: 'loaded', callback: () => void) => void,
|
|
once: (eventName: 'loaded', callback: () => void) => void,
|
|
defaultApp?: ?boolean,
|
|
mas?: ?boolean,
|
|
noAsar?: ?boolean,
|
|
noDeprecation?: ?boolean,
|
|
resourcesPath?: ?string,
|
|
sandboxed?: ?boolean,
|
|
throwDeprecation?: ?boolean,
|
|
traceDeprecation?: ?boolean,
|
|
traceProcessWarnings?: ?boolean,
|
|
type?: ?string,
|
|
windowsStore?: ?boolean,
|
|
versions: {
|
|
chrome?: ?string,
|
|
electron?: ?string,
|
|
},
|
|
},
|
|
protocol: {
|
|
registerStandardSchemes: (
|
|
schemes: Array<string>,
|
|
options?: ?{
|
|
secure?: ?boolean,
|
|
},
|
|
) => void,
|
|
registerServiceWorkerSchemes: (schemes: Array<string>) => void,
|
|
registerFileProtocol: (
|
|
scheme: string,
|
|
handler: Function,
|
|
completion?: ?Function,
|
|
) => void,
|
|
registerBufferProtocol: (
|
|
scheme: string,
|
|
handler: Function,
|
|
completion?: ?Function,
|
|
) => void,
|
|
registerStringProtocol: (
|
|
scheme: string,
|
|
handler: Function,
|
|
completion?: ?Function,
|
|
) => void,
|
|
registerHttpProtocol: (
|
|
scheme: string,
|
|
handler: Function,
|
|
completion?: ?Function,
|
|
) => void,
|
|
registerStreamProtocol: (
|
|
scheme: string,
|
|
handler: Function,
|
|
completion?: ?Function,
|
|
) => void,
|
|
unregisterProtocol: (scheme: string, completion?: ?Function) => void,
|
|
isProtocolHandled: (scheme: string, callback: Function) => void,
|
|
interceptFileProtocol: (
|
|
scheme: string,
|
|
handler: Function,
|
|
completion?: ?Function,
|
|
) => void,
|
|
interceptStringProtocol: (
|
|
scheme: string,
|
|
handler: Function,
|
|
completion?: ?Function,
|
|
) => void,
|
|
interceptBufferProtocol: (
|
|
scheme: string,
|
|
handler: Function,
|
|
completion?: ?Function,
|
|
) => void,
|
|
interceptHttpProtocol: (
|
|
scheme: string,
|
|
handler: Function,
|
|
completion?: ?Function,
|
|
) => void,
|
|
interceptStreamProtocol: (
|
|
scheme: string,
|
|
handler: Function,
|
|
completion?: ?Function,
|
|
) => void,
|
|
uninterceptProtocol: (scheme: string, completion?: ?Function) => void,
|
|
},
|
|
screen: {
|
|
getCursorScreenPoint: () => Point,
|
|
getPrimaryDisplay: () => Display,
|
|
getAllDisplays: () => Array<Display>,
|
|
getDisplayNearestPoint: (point: Point) => Display,
|
|
getDisplayMatching: (rect: Rectangle) => Display,
|
|
screenToDipPoint: (point: Point) => Point,
|
|
dipToScreenPoint: (point: Point) => Point,
|
|
screenToDipRect: (
|
|
window: BrowserWindow | null,
|
|
rect: Rectangle,
|
|
) => Rectangle,
|
|
dipToScreenRect: (
|
|
window: BrowserWindow | null,
|
|
rect: Rectangle,
|
|
) => Rectangle,
|
|
on: ((
|
|
eventName: 'display-added',
|
|
callback: (event: Event, newDisplay: Display) => void,
|
|
) => void) &
|
|
((
|
|
eventName: 'display-removed',
|
|
callback: (event: Event, oldDisplay: Display) => void,
|
|
) => void) &
|
|
((
|
|
eventName: 'display-metrics-changed',
|
|
callback: (
|
|
event: Event,
|
|
display: Display,
|
|
changedMetrics: Array<string>,
|
|
) => void,
|
|
) => void),
|
|
once: ((
|
|
eventName: 'display-added',
|
|
callback: (event: Event, newDisplay: Display) => void,
|
|
) => void) &
|
|
((
|
|
eventName: 'display-removed',
|
|
callback: (event: Event, oldDisplay: Display) => void,
|
|
) => void) &
|
|
((
|
|
eventName: 'display-metrics-changed',
|
|
callback: (
|
|
event: Event,
|
|
display: Display,
|
|
changedMetrics: Array<string>,
|
|
) => void,
|
|
) => void),
|
|
},
|
|
session: {
|
|
fromPartition: (
|
|
partition: string,
|
|
options?: ?{
|
|
cache: boolean,
|
|
},
|
|
) => Session,
|
|
defaultSession?: ?Session,
|
|
},
|
|
shell: {
|
|
showItemInFolder: (fullPath: string) => boolean,
|
|
openItem: (fullPath: string) => boolean,
|
|
openExternal: (
|
|
url: string,
|
|
options?: ?{
|
|
activate?: ?boolean,
|
|
workingDirectory?: ?string,
|
|
},
|
|
callback?: ?Function,
|
|
) => boolean,
|
|
moveItemToTrash: (fullPath: string) => boolean,
|
|
beep: () => void,
|
|
writeShortcutLink: (
|
|
shortcutPath: string,
|
|
operation?: ?'create' | 'update' | 'replace',
|
|
options: ShortcutDetails,
|
|
) => boolean,
|
|
readShortcutLink: (shortcutPath: string) => ShortcutDetails,
|
|
},
|
|
systemPreferences: {
|
|
isDarkMode: () => boolean,
|
|
isSwipeTrackingFromScrollEventsEnabled: () => boolean,
|
|
postNotification: (event: string, userInfo: {}) => void,
|
|
postLocalNotification: (event: string, userInfo: {}) => void,
|
|
postWorkspaceNotification: (event: string, userInfo: {}) => void,
|
|
subscribeNotification: (event: string, callback: Function) => number,
|
|
subscribeLocalNotification: (
|
|
event: string,
|
|
callback: Function,
|
|
) => number,
|
|
subscribeWorkspaceNotification: (
|
|
event: string,
|
|
callback: Function,
|
|
) => void,
|
|
unsubscribeNotification: (id: number) => void,
|
|
unsubscribeLocalNotification: (id: number) => void,
|
|
unsubscribeWorkspaceNotification: (id: number) => void,
|
|
registerDefaults: (defaults: {}) => void,
|
|
getUserDefault: (
|
|
key: string,
|
|
type:
|
|
| 'string'
|
|
| 'boolean'
|
|
| 'integer'
|
|
| 'float'
|
|
| 'double'
|
|
| 'url'
|
|
| 'array'
|
|
| 'dictionary',
|
|
) => any,
|
|
setUserDefault: (key: string, type: string, value: string) => void,
|
|
removeUserDefault: (key: string) => void,
|
|
isAeroGlassEnabled: () => boolean,
|
|
getAccentColor: () => string,
|
|
getColor: (
|
|
color:
|
|
| '3d-dark-shadow'
|
|
| '3d-face'
|
|
| '3d-highlight'
|
|
| '3d-light'
|
|
| '3d-shadow'
|
|
| 'active-border'
|
|
| 'active-caption'
|
|
| 'active-caption-gradient'
|
|
| 'app-workspace'
|
|
| 'button-text'
|
|
| 'caption-text'
|
|
| 'desktop'
|
|
| 'disabled-text'
|
|
| 'highlight'
|
|
| 'highlight-text'
|
|
| 'hotlight'
|
|
| 'inactive-border'
|
|
| 'inactive-caption'
|
|
| 'inactive-caption-gradient'
|
|
| 'inactive-caption-text'
|
|
| 'info-background'
|
|
| 'info-text'
|
|
| 'menu'
|
|
| 'menu-highlight'
|
|
| 'menubar'
|
|
| 'menu-text'
|
|
| 'scrollbar'
|
|
| 'window'
|
|
| 'window-frame'
|
|
| 'window-text',
|
|
) => string,
|
|
isInvertedColorScheme: () => boolean,
|
|
getEffectiveAppearance: () => 'dark' | 'light' | 'unknown',
|
|
getAppLevelAppearance: () => 'dark' | 'light' | 'unknown',
|
|
setAppLevelAppearance: (appearance: string | null) => void,
|
|
isTrustedAccessibilityClient: (prompt: boolean) => boolean,
|
|
getMediaAccessStatus: (
|
|
mediaType: string,
|
|
) => 'not-determined' | 'granted' | 'denied' | 'restricted' | 'unknown',
|
|
askForMediaAccess: (mediaType: 'microphone' | 'camera') => Promise<any>,
|
|
on: ((
|
|
eventName: 'accent-color-changed',
|
|
callback: (event: Event, newColor: string) => void,
|
|
) => void) &
|
|
((
|
|
eventName: 'color-changed',
|
|
callback: (event: Event) => void,
|
|
) => void) &
|
|
((
|
|
eventName: 'inverted-color-scheme-changed',
|
|
callback: (event: Event, invertedColorScheme: boolean) => void,
|
|
) => void) &
|
|
((
|
|
eventName: 'appearance-changed',
|
|
callback: (newAppearance: 'dark' | 'light') => void,
|
|
) => void),
|
|
once: ((
|
|
eventName: 'accent-color-changed',
|
|
callback: (event: Event, newColor: string) => void,
|
|
) => void) &
|
|
((
|
|
eventName: 'color-changed',
|
|
callback: (event: Event) => void,
|
|
) => void) &
|
|
((
|
|
eventName: 'inverted-color-scheme-changed',
|
|
callback: (event: Event, invertedColorScheme: boolean) => void,
|
|
) => void) &
|
|
((
|
|
eventName: 'appearance-changed',
|
|
callback: (newAppearance: 'dark' | 'light') => void,
|
|
) => void),
|
|
},
|
|
webContents: {
|
|
getAllWebContents: () => Array<WebContents>,
|
|
getFocusedWebContents: () => WebContents,
|
|
fromId: (id: number) => WebContents,
|
|
},
|
|
BrowserView: Class<BrowserView>,
|
|
BrowserWindow: Class<BrowserWindow>,
|
|
ClientRequest: Class<ClientRequest>,
|
|
Cookies: Class<Cookies>,
|
|
Debugger: Class<Debugger>,
|
|
DownloadItem: Class<DownloadItem>,
|
|
IncomingMessage: Class<IncomingMessage>,
|
|
Menu: Class<Menu>,
|
|
MenuItem: Class<MenuItem>,
|
|
NativeImage: Class<NativeImage>,
|
|
Notification: Class<Notification>,
|
|
Session: Class<Session>,
|
|
TouchBar: Class<TouchBar>,
|
|
Tray: Class<Tray>,
|
|
WebContents: Class<WebContents>,
|
|
WebRequest: Class<WebRequest>,
|
|
},
|
|
screen: {
|
|
getCursorScreenPoint: () => Point,
|
|
getPrimaryDisplay: () => Display,
|
|
getAllDisplays: () => Array<Display>,
|
|
getDisplayNearestPoint: (point: Point) => Display,
|
|
getDisplayMatching: (rect: Rectangle) => Display,
|
|
screenToDipPoint: (point: Point) => Point,
|
|
dipToScreenPoint: (point: Point) => Point,
|
|
screenToDipRect: (
|
|
window: BrowserWindow | null,
|
|
rect: Rectangle,
|
|
) => Rectangle,
|
|
dipToScreenRect: (
|
|
window: BrowserWindow | null,
|
|
rect: Rectangle,
|
|
) => Rectangle,
|
|
on: ((
|
|
eventName: 'display-added',
|
|
callback: (event: Event, newDisplay: Display) => void,
|
|
) => void) &
|
|
((
|
|
eventName: 'display-removed',
|
|
callback: (event: Event, oldDisplay: Display) => void,
|
|
) => void) &
|
|
((
|
|
eventName: 'display-metrics-changed',
|
|
callback: (
|
|
event: Event,
|
|
display: Display,
|
|
changedMetrics: Array<string>,
|
|
) => void,
|
|
) => void),
|
|
once: ((
|
|
eventName: 'display-added',
|
|
callback: (event: Event, newDisplay: Display) => void,
|
|
) => void) &
|
|
((
|
|
eventName: 'display-removed',
|
|
callback: (event: Event, oldDisplay: Display) => void,
|
|
) => void) &
|
|
((
|
|
eventName: 'display-metrics-changed',
|
|
callback: (
|
|
event: Event,
|
|
display: Display,
|
|
changedMetrics: Array<string>,
|
|
) => void,
|
|
) => void),
|
|
},
|
|
shell: {
|
|
showItemInFolder: (fullPath: string) => boolean,
|
|
openItem: (fullPath: string) => boolean,
|
|
openExternal: (
|
|
url: string,
|
|
options?: ?{
|
|
activate?: ?boolean,
|
|
workingDirectory?: ?string,
|
|
},
|
|
callback?: ?Function,
|
|
) => boolean,
|
|
moveItemToTrash: (fullPath: string) => boolean,
|
|
beep: () => void,
|
|
writeShortcutLink: (
|
|
shortcutPath: string,
|
|
operation?: ?'create' | 'update' | 'replace',
|
|
options: ShortcutDetails,
|
|
) => boolean,
|
|
readShortcutLink: (shortcutPath: string) => ShortcutDetails,
|
|
},
|
|
webFrame: {
|
|
setZoomFactor: (factor: number) => void,
|
|
getZoomFactor: () => number,
|
|
setZoomLevel: (level: number) => void,
|
|
getZoomLevel: () => number,
|
|
setVisualZoomLevelLimits: (
|
|
minimumLevel: number,
|
|
maximumLevel: number,
|
|
) => void,
|
|
setLayoutZoomLevelLimits: (
|
|
minimumLevel: number,
|
|
maximumLevel: number,
|
|
) => void,
|
|
setSpellCheckProvider: (
|
|
language: string,
|
|
autoCorrectWord: boolean,
|
|
provider: {
|
|
spellCheck: Function,
|
|
},
|
|
) => void,
|
|
registerURLSchemeAsBypassingCSP: (scheme: string) => void,
|
|
registerURLSchemeAsPrivileged: (
|
|
scheme: string,
|
|
options?: ?{
|
|
secure?: ?boolean,
|
|
bypassCSP?: ?boolean,
|
|
allowServiceWorkers?: ?boolean,
|
|
supportFetchAPI?: ?boolean,
|
|
corsEnabled?: ?boolean,
|
|
},
|
|
) => void,
|
|
insertText: (text: string) => void,
|
|
executeJavaScript: (
|
|
code: string,
|
|
userGesture?: ?boolean,
|
|
callback?: ?Function,
|
|
) => Promise<any>,
|
|
executeJavaScriptInIsolatedWorld: (
|
|
worldId: number,
|
|
scripts: Array<WebSource>,
|
|
userGesture?: ?boolean,
|
|
callback?: ?Function,
|
|
) => void,
|
|
setIsolatedWorldContentSecurityPolicy: (
|
|
worldId: number,
|
|
csp: string,
|
|
) => void,
|
|
setIsolatedWorldHumanReadableName: (
|
|
worldId: number,
|
|
name: string,
|
|
) => void,
|
|
setIsolatedWorldSecurityOrigin: (
|
|
worldId: number,
|
|
securityOrigin: string,
|
|
) => void,
|
|
getResourceUsage: () => {
|
|
images: MemoryUsageDetails,
|
|
scripts: MemoryUsageDetails,
|
|
cssStyleSheets: MemoryUsageDetails,
|
|
xslStyleSheets: MemoryUsageDetails,
|
|
fonts: MemoryUsageDetails,
|
|
other: MemoryUsageDetails,
|
|
},
|
|
clearCache: () => void,
|
|
getFrameForSelector: (selector: string) => WebFrame,
|
|
findFrameByName: (name: string) => WebFrame,
|
|
findFrameByRoutingId: (routingId: number) => WebFrame,
|
|
top?: ?WebFrame,
|
|
opener?: ?WebFrame,
|
|
parent?: ?WebFrame,
|
|
firstChild?: ?WebFrame,
|
|
nextSibling?: ?WebFrame,
|
|
routingId?: ?number,
|
|
},
|
|
BrowserWindowProxy: Class<BrowserWindowProxy>,
|
|
NativeImage: Class<NativeImage>,
|
|
};
|
|
declare type BluetoothDevice = {
|
|
deviceName: string,
|
|
deviceId: string,
|
|
};
|
|
declare type Certificate = {
|
|
data: string,
|
|
issuer: CertificatePrincipal,
|
|
issuerName: string,
|
|
issuerCert: Certificate,
|
|
subject: CertificatePrincipal,
|
|
subjectName: string,
|
|
serialNumber: string,
|
|
validStart: number,
|
|
validExpiry: number,
|
|
fingerprint: string,
|
|
};
|
|
declare type CertificatePrincipal = {
|
|
commonName: string,
|
|
organizations: Array<string>,
|
|
organizationUnits: Array<string>,
|
|
locality: string,
|
|
state: string,
|
|
country: string,
|
|
};
|
|
declare type Cookie = {
|
|
name: string,
|
|
value: string,
|
|
domain?: ?string,
|
|
hostOnly?: ?boolean,
|
|
path?: ?string,
|
|
secure?: ?boolean,
|
|
httpOnly?: ?boolean,
|
|
session?: ?boolean,
|
|
expirationDate?: ?number,
|
|
};
|
|
declare type CPUUsage = {
|
|
percentCPUUsage: number,
|
|
idleWakeupsPerSecond: number,
|
|
};
|
|
declare type CrashReport = {
|
|
date: Date,
|
|
id: string,
|
|
};
|
|
declare type DesktopCapturerSource = {
|
|
id: string,
|
|
name: string,
|
|
thumbnail: NativeImage,
|
|
display_id: string,
|
|
};
|
|
declare type Display = {
|
|
id: number,
|
|
rotation: number,
|
|
scaleFactor: number,
|
|
touchSupport: 'available' | 'unavailable' | 'unknown',
|
|
bounds: Rectangle,
|
|
size: Size,
|
|
workArea: Rectangle,
|
|
workAreaSize: Size,
|
|
};
|
|
declare type FileFilter = {
|
|
name: string,
|
|
extensions: Array<string>,
|
|
};
|
|
declare type GPUFeatureStatus = {
|
|
'2d_canvas': string,
|
|
flash_3d: string,
|
|
flash_stage3d: string,
|
|
flash_stage3d_baseline: string,
|
|
gpu_compositing: string,
|
|
multiple_raster_threads: string,
|
|
native_gpu_memory_buffers: string,
|
|
rasterization: string,
|
|
video_decode: string,
|
|
video_encode: string,
|
|
vpx_decode: string,
|
|
webgl: string,
|
|
webgl2: string,
|
|
};
|
|
declare type IOCounters = {
|
|
readOperationCount: number,
|
|
writeOperationCount: number,
|
|
otherOperationCount: number,
|
|
readTransferCount: number,
|
|
writeTransferCount: number,
|
|
otherTransferCount: number,
|
|
};
|
|
declare type JumpListCategory = {
|
|
type?: ?'tasks' | 'frequent' | 'recent' | 'custom',
|
|
name?: ?string,
|
|
items?: ?Array<JumpListItem>,
|
|
};
|
|
declare type JumpListItem = {
|
|
type?: ?'task' | 'separator' | 'file',
|
|
path?: ?string,
|
|
program?: ?string,
|
|
args?: ?string,
|
|
title?: ?string,
|
|
description?: ?string,
|
|
iconPath?: ?string,
|
|
iconIndex?: ?number,
|
|
};
|
|
declare type MemoryInfo = {
|
|
pid: number,
|
|
workingSetSize: number,
|
|
peakWorkingSetSize: number,
|
|
privateBytes: number,
|
|
sharedBytes: number,
|
|
};
|
|
declare type MemoryUsageDetails = {
|
|
count: number,
|
|
size: number,
|
|
liveSize: number,
|
|
};
|
|
declare type MimeTypedBuffer = {
|
|
mimeType: string,
|
|
data: Buffer,
|
|
};
|
|
declare type NotificationAction = {
|
|
type: 'button',
|
|
text?: ?string,
|
|
};
|
|
declare type Point = {
|
|
x: number,
|
|
y: number,
|
|
};
|
|
declare type PrinterInfo = {
|
|
name: string,
|
|
description: string,
|
|
status: number,
|
|
isDefault: boolean,
|
|
};
|
|
declare type ProcessMetric = {
|
|
pid: number,
|
|
type: string,
|
|
cpu: CPUUsage,
|
|
};
|
|
declare type Product = {
|
|
productIdentifier: string,
|
|
localizedDescription: string,
|
|
localizedTitle: string,
|
|
contentVersion: string,
|
|
contentLengths: Array<number>,
|
|
price: number,
|
|
formattedPrice: string,
|
|
downloadable: boolean,
|
|
};
|
|
declare type Rectangle = {
|
|
x: number,
|
|
y: number,
|
|
width: number,
|
|
height: number,
|
|
};
|
|
declare type Referrer = {
|
|
url: string,
|
|
policy:
|
|
| 'default'
|
|
| 'unsafe-url'
|
|
| 'no-referrer-when-downgrade'
|
|
| 'no-referrer'
|
|
| 'origin'
|
|
| 'strict-origin-when-cross-origin'
|
|
| 'same-origin'
|
|
| 'strict-origin',
|
|
};
|
|
declare type RemoveClientCertificate = {
|
|
type: string,
|
|
origin: string,
|
|
};
|
|
declare type RemovePassword = {
|
|
type: string,
|
|
origin?: ?string,
|
|
scheme?: ?'basic' | 'digest' | 'ntlm' | 'negotiate',
|
|
realm?: ?string,
|
|
username?: ?string,
|
|
password?: ?string,
|
|
};
|
|
declare type ScrubberItem = {
|
|
label?: ?string,
|
|
icon?: ?NativeImage,
|
|
};
|
|
declare type SegmentedControlSegment = {
|
|
label?: ?string,
|
|
icon?: ?NativeImage,
|
|
enabled?: ?boolean,
|
|
};
|
|
declare type ShortcutDetails = {
|
|
target: string,
|
|
cwd?: ?string,
|
|
args?: ?string,
|
|
description?: ?string,
|
|
icon?: ?string,
|
|
iconIndex?: ?number,
|
|
appUserModelId?: ?string,
|
|
};
|
|
declare type Size = {
|
|
width: number,
|
|
height: number,
|
|
};
|
|
declare type StreamProtocolResponse = {
|
|
statusCode: number,
|
|
headers: {},
|
|
data: ReadableStream,
|
|
};
|
|
declare type Task = {
|
|
program: string,
|
|
arguments: string,
|
|
title: string,
|
|
description: string,
|
|
iconPath: string,
|
|
iconIndex: number,
|
|
};
|
|
declare type ThumbarButton = {
|
|
icon: NativeImage,
|
|
click: Function,
|
|
tooltip?: ?string,
|
|
flags?: ?Array<string>,
|
|
};
|
|
declare type TraceCategoriesAndOptions = {
|
|
categoryFilter: string,
|
|
traceOptions: string,
|
|
};
|
|
declare type TraceConfig = {
|
|
included_categories?: ?Array<string>,
|
|
excluded_categories?: ?Array<string>,
|
|
memory_dump_config?: ?{},
|
|
};
|
|
declare type Transaction = {
|
|
transactionIdentifier: string,
|
|
transactionDate: string,
|
|
originalTransactionIdentifier: string,
|
|
transactionState:
|
|
| 'purchasing'
|
|
| 'purchased'
|
|
| 'failed'
|
|
| 'restored'
|
|
| 'deferred',
|
|
errorCode: number,
|
|
errorMessage: string,
|
|
payment: {
|
|
productIdentifier: string,
|
|
quantity: number,
|
|
},
|
|
};
|
|
declare type UploadBlob = {
|
|
type: string,
|
|
blobUUID: string,
|
|
};
|
|
declare type UploadData = {
|
|
bytes: Buffer,
|
|
file: string,
|
|
blobUUID: string,
|
|
};
|
|
declare type UploadFile = {
|
|
type: string,
|
|
filePath: string,
|
|
offset: number,
|
|
length: number,
|
|
modificationTime: number,
|
|
};
|
|
declare type UploadRawData = {
|
|
type: string,
|
|
bytes: Buffer,
|
|
};
|
|
declare type WebSource = {
|
|
code: string,
|
|
url?: ?string,
|
|
startLine?: ?number,
|
|
};
|
|
declare class webviewTag extends HTMLElement {
|
|
loadURL: (
|
|
url: URL,
|
|
options?: ?{
|
|
httpReferrer?: ?string | Referrer,
|
|
userAgent?: ?string,
|
|
extraHeaders?: ?string,
|
|
postData?:
|
|
| ?Array<UploadRawData>
|
|
| Array<UploadFile>
|
|
| Array<UploadBlob>,
|
|
baseURLForDataURL?: ?string,
|
|
},
|
|
) => void;
|
|
downloadURL: (url: string) => void;
|
|
getURL: () => string;
|
|
getTitle: () => string;
|
|
isLoading: () => boolean;
|
|
isLoadingMainFrame: () => boolean;
|
|
isWaitingForResponse: () => boolean;
|
|
stop: () => void;
|
|
reload: () => void;
|
|
reloadIgnoringCache: () => void;
|
|
canGoBack: () => boolean;
|
|
canGoForward: () => boolean;
|
|
canGoToOffset: (offset: number) => boolean;
|
|
clearHistory: () => void;
|
|
goBack: () => void;
|
|
goForward: () => void;
|
|
goToIndex: (index: number) => void;
|
|
goToOffset: (offset: number) => void;
|
|
isCrashed: () => boolean;
|
|
setUserAgent: (userAgent: string) => void;
|
|
getUserAgent: () => string;
|
|
insertCSS: (css: string) => void;
|
|
executeJavaScript: (
|
|
code: string,
|
|
userGesture?: ?boolean,
|
|
callback?: ?Function,
|
|
) => void;
|
|
openDevTools: () => void;
|
|
closeDevTools: () => void;
|
|
isDevToolsOpened: () => boolean;
|
|
isDevToolsFocused: () => boolean;
|
|
inspectElement: (x: number, y: number) => void;
|
|
inspectServiceWorker: () => void;
|
|
setAudioMuted: (muted: boolean) => void;
|
|
isAudioMuted: () => boolean;
|
|
isCurrentlyAudible: () => boolean;
|
|
undo: () => void;
|
|
redo: () => void;
|
|
cut: () => void;
|
|
copy: () => void;
|
|
paste: () => void;
|
|
pasteAndMatchStyle: () => void;
|
|
delete: () => void;
|
|
selectAll: () => void;
|
|
unselect: () => void;
|
|
replace: (text: string) => void;
|
|
replaceMisspelling: (text: string) => void;
|
|
insertText: (text: string) => void;
|
|
findInPage: (
|
|
text: string,
|
|
options?: ?{
|
|
forward?: ?boolean,
|
|
findNext?: ?boolean,
|
|
matchCase?: ?boolean,
|
|
wordStart?: ?boolean,
|
|
medialCapitalAsWordStart?: ?boolean,
|
|
},
|
|
) => number;
|
|
stopFindInPage: (
|
|
action: 'clearSelection' | 'keepSelection' | 'activateSelection',
|
|
) => void;
|
|
print: (
|
|
options?: ?{
|
|
silent?: ?boolean,
|
|
printBackground?: ?boolean,
|
|
deviceName?: ?string,
|
|
},
|
|
) => void;
|
|
printToPDF: (
|
|
options: {
|
|
marginsType?: ?number,
|
|
pageSize?: ?string | Size,
|
|
printBackground?: ?boolean,
|
|
printSelectionOnly?: ?boolean,
|
|
landscape?: ?boolean,
|
|
},
|
|
callback: Function,
|
|
) => void;
|
|
capturePage: ((rect?: ?Rectangle, callback: Function) => void) &
|
|
((callback: Function) => void);
|
|
send: (channel: string, ...args: Array<any>) => void;
|
|
sendInputEvent: (event: {}) => void;
|
|
setZoomFactor: (factor: number) => void;
|
|
setZoomLevel: (level: number) => void;
|
|
getZoomFactor: (callback: Function) => void;
|
|
getZoomLevel: (callback: Function) => void;
|
|
setVisualZoomLevelLimits: (
|
|
minimumLevel: number,
|
|
maximumLevel: number,
|
|
) => void;
|
|
setLayoutZoomLevelLimits: (
|
|
minimumLevel: number,
|
|
maximumLevel: number,
|
|
) => void;
|
|
showDefinitionForSelection: () => void;
|
|
getWebContents: () => WebContents;
|
|
on: ((
|
|
eventName: 'load-commit',
|
|
callback: (url: string, isMainFrame: boolean) => void,
|
|
) => void) &
|
|
((eventName: 'did-finish-load', callback: () => void) => void) &
|
|
((
|
|
eventName: 'did-fail-load',
|
|
callback: (
|
|
errorCode: number,
|
|
errorDescription: string,
|
|
validatedURL: string,
|
|
isMainFrame: boolean,
|
|
) => void,
|
|
) => void) &
|
|
((
|
|
eventName: 'did-frame-finish-load',
|
|
callback: (isMainFrame: boolean) => void,
|
|
) => void) &
|
|
((eventName: 'did-start-loading', callback: () => void) => void) &
|
|
((eventName: 'did-stop-loading', callback: () => void) => void) &
|
|
((eventName: 'dom-ready', callback: () => void) => void) &
|
|
((
|
|
eventName: 'page-title-updated',
|
|
callback: (title: string, explicitSet: boolean) => void,
|
|
) => void) &
|
|
((
|
|
eventName: 'page-favicon-updated',
|
|
callback: (favicons: Array<string>) => void,
|
|
) => void) &
|
|
((eventName: 'enter-html-full-screen', callback: () => void) => void) &
|
|
((eventName: 'leave-html-full-screen', callback: () => void) => void) &
|
|
((
|
|
eventName: 'console-message',
|
|
callback: (
|
|
level: number,
|
|
message: string,
|
|
line: number,
|
|
sourceId: string,
|
|
) => void,
|
|
) => void) &
|
|
((
|
|
eventName: 'found-in-page',
|
|
callback: (result: {
|
|
requestId: number,
|
|
activeMatchOrdinal: number,
|
|
matches: number,
|
|
selectionArea: {},
|
|
finalUpdate: boolean,
|
|
}) => void,
|
|
) => void) &
|
|
((
|
|
eventName: 'new-window',
|
|
callback: (
|
|
url: string,
|
|
frameName: string,
|
|
disposition:
|
|
| 'default'
|
|
| 'foreground-tab'
|
|
| 'background-tab'
|
|
| 'new-window'
|
|
| 'save-to-disk'
|
|
| 'other',
|
|
options: {},
|
|
) => void,
|
|
) => void) &
|
|
((eventName: 'will-navigate', callback: (url: string) => void) => void) &
|
|
((eventName: 'did-navigate', callback: (url: string) => void) => void) &
|
|
((
|
|
eventName: 'did-navigate-in-page',
|
|
callback: (isMainFrame: boolean, url: string) => void,
|
|
) => void) &
|
|
((eventName: 'close', callback: () => void) => void) &
|
|
((
|
|
eventName: 'ipc-message',
|
|
callback: (channel: string, args: Array<any>) => void,
|
|
) => void) &
|
|
((eventName: 'crashed', callback: () => void) => void) &
|
|
((eventName: 'gpu-crashed', callback: () => void) => void) &
|
|
((
|
|
eventName: 'plugin-crashed',
|
|
callback: (name: string, version: string) => void,
|
|
) => void) &
|
|
((eventName: 'destroyed', callback: () => void) => void) &
|
|
((eventName: 'media-started-playing', callback: () => void) => void) &
|
|
((eventName: 'media-paused', callback: () => void) => void) &
|
|
((
|
|
eventName: 'did-change-theme-color',
|
|
callback: (themeColor: string) => void,
|
|
) => void) &
|
|
((
|
|
eventName: 'update-target-url',
|
|
callback: (url: string) => void,
|
|
) => void) &
|
|
((eventName: 'devtools-opened', callback: () => void) => void) &
|
|
((eventName: 'devtools-closed', callback: () => void) => void) &
|
|
((eventName: 'devtools-focused', callback: () => void) => void);
|
|
once: ((
|
|
eventName: 'load-commit',
|
|
callback: (url: string, isMainFrame: boolean) => void,
|
|
) => void) &
|
|
((eventName: 'did-finish-load', callback: () => void) => void) &
|
|
((
|
|
eventName: 'did-fail-load',
|
|
callback: (
|
|
errorCode: number,
|
|
errorDescription: string,
|
|
validatedURL: string,
|
|
isMainFrame: boolean,
|
|
) => void,
|
|
) => void) &
|
|
((
|
|
eventName: 'did-frame-finish-load',
|
|
callback: (isMainFrame: boolean) => void,
|
|
) => void) &
|
|
((eventName: 'did-start-loading', callback: () => void) => void) &
|
|
((eventName: 'did-stop-loading', callback: () => void) => void) &
|
|
((eventName: 'dom-ready', callback: () => void) => void) &
|
|
((
|
|
eventName: 'page-title-updated',
|
|
callback: (title: string, explicitSet: boolean) => void,
|
|
) => void) &
|
|
((
|
|
eventName: 'page-favicon-updated',
|
|
callback: (favicons: Array<string>) => void,
|
|
) => void) &
|
|
((eventName: 'enter-html-full-screen', callback: () => void) => void) &
|
|
((eventName: 'leave-html-full-screen', callback: () => void) => void) &
|
|
((
|
|
eventName: 'console-message',
|
|
callback: (
|
|
level: number,
|
|
message: string,
|
|
line: number,
|
|
sourceId: string,
|
|
) => void,
|
|
) => void) &
|
|
((
|
|
eventName: 'found-in-page',
|
|
callback: (result: {
|
|
requestId: number,
|
|
activeMatchOrdinal: number,
|
|
matches: number,
|
|
selectionArea: {},
|
|
finalUpdate: boolean,
|
|
}) => void,
|
|
) => void) &
|
|
((
|
|
eventName: 'new-window',
|
|
callback: (
|
|
url: string,
|
|
frameName: string,
|
|
disposition:
|
|
| 'default'
|
|
| 'foreground-tab'
|
|
| 'background-tab'
|
|
| 'new-window'
|
|
| 'save-to-disk'
|
|
| 'other',
|
|
options: {},
|
|
) => void,
|
|
) => void) &
|
|
((eventName: 'will-navigate', callback: (url: string) => void) => void) &
|
|
((eventName: 'did-navigate', callback: (url: string) => void) => void) &
|
|
((
|
|
eventName: 'did-navigate-in-page',
|
|
callback: (isMainFrame: boolean, url: string) => void,
|
|
) => void) &
|
|
((eventName: 'close', callback: () => void) => void) &
|
|
((
|
|
eventName: 'ipc-message',
|
|
callback: (channel: string, args: Array<any>) => void,
|
|
) => void) &
|
|
((eventName: 'crashed', callback: () => void) => void) &
|
|
((eventName: 'gpu-crashed', callback: () => void) => void) &
|
|
((
|
|
eventName: 'plugin-crashed',
|
|
callback: (name: string, version: string) => void,
|
|
) => void) &
|
|
((eventName: 'destroyed', callback: () => void) => void) &
|
|
((eventName: 'media-started-playing', callback: () => void) => void) &
|
|
((eventName: 'media-paused', callback: () => void) => void) &
|
|
((
|
|
eventName: 'did-change-theme-color',
|
|
callback: (themeColor: string) => void,
|
|
) => void) &
|
|
((
|
|
eventName: 'update-target-url',
|
|
callback: (url: string) => void,
|
|
) => void) &
|
|
((eventName: 'devtools-opened', callback: () => void) => void) &
|
|
((eventName: 'devtools-closed', callback: () => void) => void) &
|
|
((eventName: 'devtools-focused', callback: () => void) => void);
|
|
}
|
|
declare class BrowserView {
|
|
constructor(
|
|
options?: ?{
|
|
webPreferences?: ?{},
|
|
},
|
|
): BrowserView;
|
|
static getAllViews: () => Array<BrowserView>;
|
|
static fromWebContents: (webContents: WebContents) => BrowserView | null;
|
|
static fromId: (id: number) => BrowserView;
|
|
destroy: () => void;
|
|
isDestroyed: () => boolean;
|
|
setAutoResize: (options: {
|
|
width: boolean,
|
|
height: boolean,
|
|
}) => void;
|
|
setBounds: (bounds: Rectangle) => void;
|
|
setBackgroundColor: (color: string) => void;
|
|
webContents: WebContents;
|
|
id: number;
|
|
}
|
|
declare class BrowserWindow {
|
|
constructor(
|
|
options?: ?{
|
|
width?: ?number,
|
|
height?: ?number,
|
|
x?: ?number,
|
|
y?: ?number,
|
|
useContentSize?: ?boolean,
|
|
center?: ?boolean,
|
|
minWidth?: ?number,
|
|
minHeight?: ?number,
|
|
maxWidth?: ?number,
|
|
maxHeight?: ?number,
|
|
resizable?: ?boolean,
|
|
movable?: ?boolean,
|
|
minimizable?: ?boolean,
|
|
maximizable?: ?boolean,
|
|
closable?: ?boolean,
|
|
focusable?: ?boolean,
|
|
alwaysOnTop?: ?boolean,
|
|
fullscreen?: ?boolean,
|
|
fullscreenable?: ?boolean,
|
|
simpleFullscreen?: ?boolean,
|
|
skipTaskbar?: ?boolean,
|
|
kiosk?: ?boolean,
|
|
title?: ?string,
|
|
icon?: ?NativeImage | string,
|
|
show?: ?boolean,
|
|
frame?: ?boolean,
|
|
parent?: ?BrowserWindow,
|
|
modal?: ?boolean,
|
|
acceptFirstMouse?: ?boolean,
|
|
disableAutoHideCursor?: ?boolean,
|
|
autoHideMenuBar?: ?boolean,
|
|
enableLargerThanScreen?: ?boolean,
|
|
backgroundColor?: ?string,
|
|
hasShadow?: ?boolean,
|
|
opacity?: ?number,
|
|
darkTheme?: ?boolean,
|
|
transparent?: ?boolean,
|
|
type?: ?string,
|
|
titleBarStyle?:
|
|
| ?'default'
|
|
| 'hidden'
|
|
| 'hiddenInset'
|
|
| 'customButtonsOnHover',
|
|
fullscreenWindowTitle?: ?boolean,
|
|
thickFrame?: ?boolean,
|
|
vibrancy?:
|
|
| ?'appearance-based'
|
|
| 'light'
|
|
| 'dark'
|
|
| 'titlebar'
|
|
| 'selection'
|
|
| 'menu'
|
|
| 'popover'
|
|
| 'sidebar'
|
|
| 'medium-light'
|
|
| 'ultra-dark',
|
|
zoomToPageWidth?: ?boolean,
|
|
tabbingIdentifier?: ?string,
|
|
webPreferences?: ?{
|
|
devTools?: ?boolean,
|
|
nodeIntegration?: ?boolean,
|
|
nodeIntegrationInWorker?: ?boolean,
|
|
preload?: ?string,
|
|
sandbox?: ?boolean,
|
|
enableRemoteModule?: ?boolean,
|
|
session?: ?Session,
|
|
partition?: ?string,
|
|
affinity?: ?string,
|
|
zoomFactor?: ?number,
|
|
javascript?: ?boolean,
|
|
webSecurity?: ?boolean,
|
|
allowRunningInsecureContent?: ?boolean,
|
|
images?: ?boolean,
|
|
textAreasAreResizable?: ?boolean,
|
|
webgl?: ?boolean,
|
|
webaudio?: ?boolean,
|
|
plugins?: ?boolean,
|
|
experimentalFeatures?: ?boolean,
|
|
scrollBounce?: ?boolean,
|
|
enableBlinkFeatures?: ?string,
|
|
disableBlinkFeatures?: ?string,
|
|
defaultFontFamily?: ?{
|
|
standard?: ?string,
|
|
serif?: ?string,
|
|
sansSerif?: ?string,
|
|
monospace?: ?string,
|
|
cursive?: ?string,
|
|
fantasy?: ?string,
|
|
},
|
|
defaultFontSize?: ?number,
|
|
defaultMonospaceFontSize?: ?number,
|
|
minimumFontSize?: ?number,
|
|
defaultEncoding?: ?string,
|
|
backgroundThrottling?: ?boolean,
|
|
offscreen?: ?boolean,
|
|
contextIsolation?: ?boolean,
|
|
nativeWindowOpen?: ?boolean,
|
|
webviewTag?: ?boolean,
|
|
additionalArguments?: ?Array<string>,
|
|
safeDialogs?: ?boolean,
|
|
safeDialogsMessage?: ?string,
|
|
navigateOnDragDrop?: ?boolean,
|
|
},
|
|
},
|
|
): BrowserWindow;
|
|
static getAllWindows: () => Array<BrowserWindow>;
|
|
static getFocusedWindow: () => BrowserWindow | null;
|
|
static fromWebContents: (webContents: WebContents) => BrowserWindow;
|
|
static fromBrowserView: (browserView: BrowserView) => BrowserWindow | null;
|
|
static fromId: (id: number) => BrowserWindow;
|
|
static addExtension: (path: string) => void;
|
|
static removeExtension: (name: string) => void;
|
|
static getExtensions: () => {};
|
|
static addDevToolsExtension: (path: string) => void;
|
|
static removeDevToolsExtension: (name: string) => void;
|
|
static getDevToolsExtensions: () => {};
|
|
destroy: () => void;
|
|
close: () => void;
|
|
focus: () => void;
|
|
blur: () => void;
|
|
isFocused: () => boolean;
|
|
isDestroyed: () => boolean;
|
|
show: () => void;
|
|
showInactive: () => void;
|
|
hide: () => void;
|
|
isVisible: () => boolean;
|
|
isModal: () => boolean;
|
|
maximize: () => void;
|
|
unmaximize: () => void;
|
|
isMaximized: () => boolean;
|
|
minimize: () => void;
|
|
restore: () => void;
|
|
isMinimized: () => boolean;
|
|
setFullScreen: (flag: boolean) => void;
|
|
isFullScreen: () => boolean;
|
|
setSimpleFullScreen: (flag: boolean) => void;
|
|
isSimpleFullScreen: () => boolean;
|
|
isNormal: () => boolean;
|
|
setAspectRatio: (aspectRatio: number, extraSize: Size) => void;
|
|
setBackgroundColor: (backgroundColor: string) => void;
|
|
previewFile: (path: string, displayName?: ?string) => void;
|
|
closeFilePreview: () => void;
|
|
setBounds: (bounds: Rectangle, animate?: ?boolean) => void;
|
|
getBounds: () => Rectangle;
|
|
setContentBounds: (bounds: Rectangle, animate?: ?boolean) => void;
|
|
getContentBounds: () => Rectangle;
|
|
getNormalBounds: () => Rectangle;
|
|
setEnabled: (enable: boolean) => void;
|
|
setSize: (width: number, height: number, animate?: ?boolean) => void;
|
|
getSize: () => Array<number>;
|
|
setContentSize: (width: number, height: number, animate?: ?boolean) => void;
|
|
getContentSize: () => Array<number>;
|
|
setMinimumSize: (width: number, height: number) => void;
|
|
getMinimumSize: () => Array<number>;
|
|
setMaximumSize: (width: number, height: number) => void;
|
|
getMaximumSize: () => Array<number>;
|
|
setResizable: (resizable: boolean) => void;
|
|
isResizable: () => boolean;
|
|
setMovable: (movable: boolean) => void;
|
|
isMovable: () => boolean;
|
|
setMinimizable: (minimizable: boolean) => void;
|
|
isMinimizable: () => boolean;
|
|
setMaximizable: (maximizable: boolean) => void;
|
|
isMaximizable: () => boolean;
|
|
setFullScreenable: (fullscreenable: boolean) => void;
|
|
isFullScreenable: () => boolean;
|
|
setClosable: (closable: boolean) => void;
|
|
isClosable: () => boolean;
|
|
setAlwaysOnTop: (
|
|
flag: boolean,
|
|
level?:
|
|
| ?'normal'
|
|
| 'floating'
|
|
| 'torn-off-menu'
|
|
| 'modal-panel'
|
|
| 'main-menu'
|
|
| 'status'
|
|
| 'pop-up-menu'
|
|
| 'screen-saver',
|
|
relativeLevel?: ?number,
|
|
) => void;
|
|
isAlwaysOnTop: () => boolean;
|
|
moveTop: () => void;
|
|
center: () => void;
|
|
setPosition: (x: number, y: number, animate?: ?boolean) => void;
|
|
getPosition: () => Array<number>;
|
|
setTitle: (title: string) => void;
|
|
getTitle: () => string;
|
|
setSheetOffset: (offsetY: number, offsetX?: ?number) => void;
|
|
flashFrame: (flag: boolean) => void;
|
|
setSkipTaskbar: (skip: boolean) => void;
|
|
setKiosk: (flag: boolean) => void;
|
|
isKiosk: () => boolean;
|
|
getNativeWindowHandle: () => Buffer;
|
|
hookWindowMessage: (message: number, callback: Function) => void;
|
|
isWindowMessageHooked: (message: number) => boolean;
|
|
unhookWindowMessage: (message: number) => void;
|
|
unhookAllWindowMessages: () => void;
|
|
setRepresentedFilename: (filename: string) => void;
|
|
getRepresentedFilename: () => string;
|
|
setDocumentEdited: (edited: boolean) => void;
|
|
isDocumentEdited: () => boolean;
|
|
focusOnWebView: () => void;
|
|
blurWebView: () => void;
|
|
capturePage: ((rect?: ?Rectangle, callback: Function) => void) &
|
|
((callback: Function) => void);
|
|
loadURL: (
|
|
url: string,
|
|
options?: ?{
|
|
httpReferrer?: ?string | Referrer,
|
|
userAgent?: ?string,
|
|
extraHeaders?: ?string,
|
|
postData?:
|
|
| ?Array<UploadRawData>
|
|
| Array<UploadFile>
|
|
| Array<UploadBlob>,
|
|
baseURLForDataURL?: ?string,
|
|
},
|
|
) => void;
|
|
loadFile: (
|
|
filePath: string,
|
|
options?: ?{
|
|
query?: ?{},
|
|
search?: ?string,
|
|
hash?: ?string,
|
|
},
|
|
) => void;
|
|
reload: () => void;
|
|
setMenu: (menu: Menu | null) => void;
|
|
setProgressBar: (
|
|
progress: number,
|
|
options?: ?{
|
|
mode: 'none' | 'normal' | 'indeterminate' | 'error' | 'paused',
|
|
},
|
|
) => void;
|
|
setOverlayIcon: (overlay: NativeImage | null, description: string) => void;
|
|
setHasShadow: (hasShadow: boolean) => void;
|
|
hasShadow: () => boolean;
|
|
setOpacity: (opacity: number) => void;
|
|
getOpacity: () => number;
|
|
setShape: (rects: Array<Rectangle>) => void;
|
|
setThumbarButtons: (buttons: Array<ThumbarButton>) => boolean;
|
|
setThumbnailClip: (region: Rectangle) => void;
|
|
setThumbnailToolTip: (toolTip: string) => void;
|
|
setAppDetails: (options: {
|
|
appId?: ?string,
|
|
appIconPath?: ?string,
|
|
appIconIndex?: ?number,
|
|
relaunchCommand?: ?string,
|
|
relaunchDisplayName?: ?string,
|
|
}) => void;
|
|
showDefinitionForSelection: () => void;
|
|
setIcon: (icon: NativeImage) => void;
|
|
setWindowButtonVisibility: (visible: boolean) => void;
|
|
setAutoHideMenuBar: (hide: boolean) => void;
|
|
isMenuBarAutoHide: () => boolean;
|
|
setMenuBarVisibility: (visible: boolean) => void;
|
|
isMenuBarVisible: () => boolean;
|
|
setVisibleOnAllWorkspaces: (
|
|
visible: boolean,
|
|
options?: ?{
|
|
visibleOnFullScreen?: ?boolean,
|
|
},
|
|
) => void;
|
|
isVisibleOnAllWorkspaces: () => boolean;
|
|
setIgnoreMouseEvents: (
|
|
ignore: boolean,
|
|
options?: ?{
|
|
forward?: ?boolean,
|
|
},
|
|
) => void;
|
|
setContentProtection: (enable: boolean) => void;
|
|
setFocusable: (focusable: boolean) => void;
|
|
setParentWindow: (parent: BrowserWindow) => void;
|
|
getParentWindow: () => BrowserWindow;
|
|
getChildWindows: () => Array<BrowserWindow>;
|
|
setAutoHideCursor: (autoHide: boolean) => void;
|
|
selectPreviousTab: () => void;
|
|
selectNextTab: () => void;
|
|
mergeAllWindows: () => void;
|
|
moveTabToNewWindow: () => void;
|
|
toggleTabBar: () => void;
|
|
addTabbedWindow: (browserWindow: BrowserWindow) => void;
|
|
setVibrancy: (
|
|
type:
|
|
| 'appearance-based'
|
|
| 'light'
|
|
| 'dark'
|
|
| 'titlebar'
|
|
| 'selection'
|
|
| 'menu'
|
|
| 'popover'
|
|
| 'sidebar'
|
|
| 'medium-light'
|
|
| 'ultra-dark',
|
|
) => void;
|
|
setTouchBar: (touchBar: TouchBar) => void;
|
|
setBrowserView: (browserView: BrowserView) => void;
|
|
getBrowserView: () => BrowserView | null;
|
|
webContents: WebContents;
|
|
id: number;
|
|
on: ((
|
|
eventName: 'page-title-updated',
|
|
callback: (event: Event, title: string) => void,
|
|
) => void) &
|
|
((eventName: 'close', callback: (event: Event) => void) => void) &
|
|
((eventName: 'closed', callback: () => void) => void) &
|
|
((eventName: 'session-end', callback: () => void) => void) &
|
|
((eventName: 'unresponsive', callback: () => void) => void) &
|
|
((eventName: 'responsive', callback: () => void) => void) &
|
|
((eventName: 'blur', callback: () => void) => void) &
|
|
((eventName: 'focus', callback: () => void) => void) &
|
|
((eventName: 'show', callback: () => void) => void) &
|
|
((eventName: 'hide', callback: () => void) => void) &
|
|
((eventName: 'ready-to-show', callback: () => void) => void) &
|
|
((eventName: 'maximize', callback: () => void) => void) &
|
|
((eventName: 'unmaximize', callback: () => void) => void) &
|
|
((eventName: 'minimize', callback: () => void) => void) &
|
|
((eventName: 'restore', callback: () => void) => void) &
|
|
((
|
|
eventName: 'will-resize',
|
|
callback: (event: Event, newBounds: Rectangle) => void,
|
|
) => void) &
|
|
((eventName: 'resize', callback: () => void) => void) &
|
|
((
|
|
eventName: 'will-move',
|
|
callback: (event: Event, newBounds: Rectangle) => void,
|
|
) => void) &
|
|
((eventName: 'move', callback: () => void) => void) &
|
|
((eventName: 'moved', callback: () => void) => void) &
|
|
((eventName: 'enter-full-screen', callback: () => void) => void) &
|
|
((eventName: 'leave-full-screen', callback: () => void) => void) &
|
|
((eventName: 'enter-html-full-screen', callback: () => void) => void) &
|
|
((eventName: 'leave-html-full-screen', callback: () => void) => void) &
|
|
((
|
|
eventName: 'always-on-top-changed',
|
|
callback: (event: Event, isAlwaysOnTop: boolean) => void,
|
|
) => void) &
|
|
((
|
|
eventName: 'app-command',
|
|
callback: (event: Event, command: string) => void,
|
|
) => void) &
|
|
((eventName: 'scroll-touch-begin', callback: () => void) => void) &
|
|
((eventName: 'scroll-touch-end', callback: () => void) => void) &
|
|
((eventName: 'scroll-touch-edge', callback: () => void) => void) &
|
|
((
|
|
eventName: 'swipe',
|
|
callback: (event: Event, direction: string) => void,
|
|
) => void) &
|
|
((eventName: 'sheet-begin', callback: () => void) => void) &
|
|
((eventName: 'sheet-end', callback: () => void) => void) &
|
|
((eventName: 'new-window-for-tab', callback: () => void) => void);
|
|
once: ((
|
|
eventName: 'page-title-updated',
|
|
callback: (event: Event, title: string) => void,
|
|
) => void) &
|
|
((eventName: 'close', callback: (event: Event) => void) => void) &
|
|
((eventName: 'closed', callback: () => void) => void) &
|
|
((eventName: 'session-end', callback: () => void) => void) &
|
|
((eventName: 'unresponsive', callback: () => void) => void) &
|
|
((eventName: 'responsive', callback: () => void) => void) &
|
|
((eventName: 'blur', callback: () => void) => void) &
|
|
((eventName: 'focus', callback: () => void) => void) &
|
|
((eventName: 'show', callback: () => void) => void) &
|
|
((eventName: 'hide', callback: () => void) => void) &
|
|
((eventName: 'ready-to-show', callback: () => void) => void) &
|
|
((eventName: 'maximize', callback: () => void) => void) &
|
|
((eventName: 'unmaximize', callback: () => void) => void) &
|
|
((eventName: 'minimize', callback: () => void) => void) &
|
|
((eventName: 'restore', callback: () => void) => void) &
|
|
((
|
|
eventName: 'will-resize',
|
|
callback: (event: Event, newBounds: Rectangle) => void,
|
|
) => void) &
|
|
((eventName: 'resize', callback: () => void) => void) &
|
|
((
|
|
eventName: 'will-move',
|
|
callback: (event: Event, newBounds: Rectangle) => void,
|
|
) => void) &
|
|
((eventName: 'move', callback: () => void) => void) &
|
|
((eventName: 'moved', callback: () => void) => void) &
|
|
((eventName: 'enter-full-screen', callback: () => void) => void) &
|
|
((eventName: 'leave-full-screen', callback: () => void) => void) &
|
|
((eventName: 'enter-html-full-screen', callback: () => void) => void) &
|
|
((eventName: 'leave-html-full-screen', callback: () => void) => void) &
|
|
((
|
|
eventName: 'always-on-top-changed',
|
|
callback: (event: Event, isAlwaysOnTop: boolean) => void,
|
|
) => void) &
|
|
((
|
|
eventName: 'app-command',
|
|
callback: (event: Event, command: string) => void,
|
|
) => void) &
|
|
((eventName: 'scroll-touch-begin', callback: () => void) => void) &
|
|
((eventName: 'scroll-touch-end', callback: () => void) => void) &
|
|
((eventName: 'scroll-touch-edge', callback: () => void) => void) &
|
|
((
|
|
eventName: 'swipe',
|
|
callback: (event: Event, direction: string) => void,
|
|
) => void) &
|
|
((eventName: 'sheet-begin', callback: () => void) => void) &
|
|
((eventName: 'sheet-end', callback: () => void) => void) &
|
|
((eventName: 'new-window-for-tab', callback: () => void) => void);
|
|
}
|
|
declare class BrowserWindowProxy {
|
|
blur: () => void;
|
|
close: () => void;
|
|
eval: (code: string) => void;
|
|
focus: () => void;
|
|
print: () => void;
|
|
postMessage: (message: string, targetOrigin: string) => void;
|
|
closed: boolean;
|
|
}
|
|
declare class ClientRequest {
|
|
constructor(options: Object | string): ClientRequest;
|
|
setHeader: (name: string, value: {}) => void;
|
|
getHeader: (
|
|
name: string,
|
|
) => {
|
|
name: string,
|
|
};
|
|
removeHeader: (name: string) => void;
|
|
write: (
|
|
chunk: string | Buffer,
|
|
encoding?: ?string,
|
|
callback?: ?Function,
|
|
) => void;
|
|
end: ((
|
|
chunk?: ?string | Buffer,
|
|
encoding?: ?string,
|
|
callback?: ?Function,
|
|
) => void) &
|
|
(((encoding?: ?string, callback?: ?Function) => void) &
|
|
((callback?: ?Function) => void));
|
|
abort: () => void;
|
|
followRedirect: () => void;
|
|
getUploadProgress: () => {
|
|
active: boolean,
|
|
started: boolean,
|
|
current: number,
|
|
total: number,
|
|
};
|
|
chunkedEncoding: boolean;
|
|
on: ((
|
|
eventName: 'response',
|
|
callback: (response: IncomingMessage) => void,
|
|
) => void) &
|
|
((
|
|
eventName: 'login',
|
|
callback: (
|
|
authInfo: {
|
|
isProxy: boolean,
|
|
scheme: string,
|
|
host: string,
|
|
port: number,
|
|
realm: string,
|
|
},
|
|
callback: Function,
|
|
) => void,
|
|
) => void) &
|
|
((eventName: 'finish', callback: () => void) => void) &
|
|
((eventName: 'abort', callback: () => void) => void) &
|
|
((eventName: 'error', callback: (error: Error) => void) => void) &
|
|
((eventName: 'close', callback: () => void) => void) &
|
|
((
|
|
eventName: 'redirect',
|
|
callback: (
|
|
statusCode: number,
|
|
method: string,
|
|
redirectUrl: string,
|
|
responseHeaders: {},
|
|
) => void,
|
|
) => void);
|
|
once: ((
|
|
eventName: 'response',
|
|
callback: (response: IncomingMessage) => void,
|
|
) => void) &
|
|
((
|
|
eventName: 'login',
|
|
callback: (
|
|
authInfo: {
|
|
isProxy: boolean,
|
|
scheme: string,
|
|
host: string,
|
|
port: number,
|
|
realm: string,
|
|
},
|
|
callback: Function,
|
|
) => void,
|
|
) => void) &
|
|
((eventName: 'finish', callback: () => void) => void) &
|
|
((eventName: 'abort', callback: () => void) => void) &
|
|
((eventName: 'error', callback: (error: Error) => void) => void) &
|
|
((eventName: 'close', callback: () => void) => void) &
|
|
((
|
|
eventName: 'redirect',
|
|
callback: (
|
|
statusCode: number,
|
|
method: string,
|
|
redirectUrl: string,
|
|
responseHeaders: {},
|
|
) => void,
|
|
) => void);
|
|
}
|
|
declare class Cookies {
|
|
get: (
|
|
filter: {
|
|
url?: ?string,
|
|
name?: ?string,
|
|
domain?: ?string,
|
|
path?: ?string,
|
|
secure?: ?boolean,
|
|
session?: ?boolean,
|
|
},
|
|
callback: Function,
|
|
) => void;
|
|
set: (
|
|
details: {
|
|
url: string,
|
|
name?: ?string,
|
|
value?: ?string,
|
|
domain?: ?string,
|
|
path?: ?string,
|
|
secure?: ?boolean,
|
|
httpOnly?: ?boolean,
|
|
expirationDate?: ?number,
|
|
},
|
|
callback: Function,
|
|
) => void;
|
|
remove: (url: string, name: string, callback: Function) => void;
|
|
flushStore: (callback: Function) => void;
|
|
on: (
|
|
eventName: 'changed',
|
|
callback: (
|
|
event: Event,
|
|
cookie: Cookie,
|
|
cause:
|
|
| 'explicit'
|
|
| 'overwrite'
|
|
| 'expired'
|
|
| 'evicted'
|
|
| 'expired-overwrite',
|
|
removed: boolean,
|
|
) => void,
|
|
) => void;
|
|
once: (
|
|
eventName: 'changed',
|
|
callback: (
|
|
event: Event,
|
|
cookie: Cookie,
|
|
cause:
|
|
| 'explicit'
|
|
| 'overwrite'
|
|
| 'expired'
|
|
| 'evicted'
|
|
| 'expired-overwrite',
|
|
removed: boolean,
|
|
) => void,
|
|
) => void;
|
|
}
|
|
declare class Debugger {
|
|
attach: (protocolVersion?: ?string) => void;
|
|
isAttached: () => boolean;
|
|
detach: () => void;
|
|
sendCommand: (
|
|
method: string,
|
|
commandParams?: ?{},
|
|
callback?: ?Function,
|
|
) => void;
|
|
on: ((
|
|
eventName: 'detach',
|
|
callback: (event: Event, reason: string) => void,
|
|
) => void) &
|
|
((
|
|
eventName: 'message',
|
|
callback: (event: Event, method: string, params: {}) => void,
|
|
) => void);
|
|
once: ((
|
|
eventName: 'detach',
|
|
callback: (event: Event, reason: string) => void,
|
|
) => void) &
|
|
((
|
|
eventName: 'message',
|
|
callback: (event: Event, method: string, params: {}) => void,
|
|
) => void);
|
|
}
|
|
declare class DownloadItem {
|
|
setSavePath: (path: string) => void;
|
|
getSavePath: () => string;
|
|
pause: () => void;
|
|
isPaused: () => boolean;
|
|
resume: () => void;
|
|
canResume: () => boolean;
|
|
cancel: () => void;
|
|
getURL: () => string;
|
|
getMimeType: () => string;
|
|
hasUserGesture: () => boolean;
|
|
getFilename: () => string;
|
|
getTotalBytes: () => number;
|
|
getReceivedBytes: () => number;
|
|
getContentDisposition: () => string;
|
|
getState: () => 'progressing' | 'completed' | 'cancelled' | 'interrupted';
|
|
getURLChain: () => Array<string>;
|
|
getLastModifiedTime: () => string;
|
|
getETag: () => string;
|
|
getStartTime: () => number;
|
|
on: ((
|
|
eventName: 'updated',
|
|
callback: (event: Event, state: 'progressing' | 'interrupted') => void,
|
|
) => void) &
|
|
((
|
|
eventName: 'done',
|
|
callback: (
|
|
event: Event,
|
|
state: 'completed' | 'cancelled' | 'interrupted',
|
|
) => void,
|
|
) => void);
|
|
once: ((
|
|
eventName: 'updated',
|
|
callback: (event: Event, state: 'progressing' | 'interrupted') => void,
|
|
) => void) &
|
|
((
|
|
eventName: 'done',
|
|
callback: (
|
|
event: Event,
|
|
state: 'completed' | 'cancelled' | 'interrupted',
|
|
) => void,
|
|
) => void);
|
|
}
|
|
declare class IncomingMessage {
|
|
statusCode: number;
|
|
statusMessage: string;
|
|
headers: {};
|
|
httpVersion: string;
|
|
httpVersionMajor: number;
|
|
httpVersionMinor: number;
|
|
on: ((eventName: 'data', callback: (chunk: Buffer) => void) => void) &
|
|
((eventName: 'end', callback: () => void) => void) &
|
|
((eventName: 'aborted', callback: () => void) => void) &
|
|
((eventName: 'error', callback: () => void) => void);
|
|
once: ((eventName: 'data', callback: (chunk: Buffer) => void) => void) &
|
|
((eventName: 'end', callback: () => void) => void) &
|
|
((eventName: 'aborted', callback: () => void) => void) &
|
|
((eventName: 'error', callback: () => void) => void);
|
|
}
|
|
declare class Menu {
|
|
constructor(): Menu;
|
|
static setApplicationMenu: (menu: Menu | null) => void;
|
|
static getApplicationMenu: () => Menu | null;
|
|
static sendActionToFirstResponder: (action: string) => void;
|
|
static buildFromTemplate: (
|
|
template: Array<MenuItemConstructorOptions>,
|
|
) => Menu;
|
|
popup: (
|
|
options?: ?{
|
|
window?: ?BrowserWindow,
|
|
x?: ?number,
|
|
y?: ?number,
|
|
positioningItem?: ?number,
|
|
callback?: ?Function,
|
|
},
|
|
) => void;
|
|
closePopup: (browserWindow?: ?BrowserWindow) => void;
|
|
append: (menuItem: MenuItem) => void;
|
|
getMenuItemById: (id: string) => MenuItem;
|
|
insert: (pos: number, menuItem: MenuItem) => void;
|
|
items: Array<MenuItem>;
|
|
on: ((
|
|
eventName: 'menu-will-show',
|
|
callback: (event: Event) => void,
|
|
) => void) &
|
|
((
|
|
eventName: 'menu-will-close',
|
|
callback: (event: Event) => void,
|
|
) => void);
|
|
once: ((
|
|
eventName: 'menu-will-show',
|
|
callback: (event: Event) => void,
|
|
) => void) &
|
|
((
|
|
eventName: 'menu-will-close',
|
|
callback: (event: Event) => void,
|
|
) => void);
|
|
}
|
|
declare class MenuItem {
|
|
constructor(options: {
|
|
click?: ?Function,
|
|
role?: ?string,
|
|
type?: ?'normal' | 'separator' | 'submenu' | 'checkbox' | 'radio',
|
|
label?: ?string,
|
|
sublabel?: ?string,
|
|
accelerator?: ?Accelerator,
|
|
icon?: ?NativeImage | string,
|
|
enabled?: ?boolean,
|
|
visible?: ?boolean,
|
|
checked?: ?boolean,
|
|
registerAccelerator?: ?boolean,
|
|
submenu?: ?Array<MenuItemConstructorOptions> | Menu,
|
|
id?: ?string,
|
|
before?: ?Array<string>,
|
|
after?: ?Array<string>,
|
|
beforeGroupContaining?: ?Array<string>,
|
|
afterGroupContaining?: ?Array<string>,
|
|
}): MenuItem;
|
|
enabled: boolean;
|
|
visible: boolean;
|
|
checked: boolean;
|
|
label: string;
|
|
click: Function;
|
|
}
|
|
declare class NativeImage {
|
|
toPNG: (
|
|
options?: ?{
|
|
scaleFactor?: ?number,
|
|
},
|
|
) => Buffer;
|
|
toJPEG: (quality: number) => Buffer;
|
|
toBitmap: (
|
|
options?: ?{
|
|
scaleFactor?: ?number,
|
|
},
|
|
) => Buffer;
|
|
toDataURL: (
|
|
options?: ?{
|
|
scaleFactor?: ?number,
|
|
},
|
|
) => string;
|
|
getBitmap: (
|
|
options?: ?{
|
|
scaleFactor?: ?number,
|
|
},
|
|
) => Buffer;
|
|
getNativeHandle: () => Buffer;
|
|
isEmpty: () => boolean;
|
|
getSize: () => Size;
|
|
setTemplateImage: (option: boolean) => void;
|
|
isTemplateImage: () => boolean;
|
|
crop: (rect: Rectangle) => NativeImage;
|
|
resize: (options: {
|
|
width?: ?number,
|
|
height?: ?number,
|
|
quality?: ?string,
|
|
}) => NativeImage;
|
|
getAspectRatio: () => number;
|
|
addRepresentation: (options: {
|
|
scaleFactor: number,
|
|
width?: ?number,
|
|
height?: ?number,
|
|
buffer?: ?Buffer,
|
|
dataURL?: ?string,
|
|
}) => void;
|
|
}
|
|
declare class Notification {
|
|
constructor(options: {
|
|
title: string,
|
|
subtitle?: ?string,
|
|
body: string,
|
|
silent?: ?boolean,
|
|
icon?: ?string | NativeImage,
|
|
hasReply?: ?boolean,
|
|
replyPlaceholder?: ?string,
|
|
sound?: ?string,
|
|
actions?: ?Array<NotificationAction>,
|
|
closeButtonText?: ?string,
|
|
}): Notification;
|
|
static isSupported: () => boolean;
|
|
show: () => void;
|
|
close: () => void;
|
|
on: ((eventName: 'show', callback: (event: Event) => void) => void) &
|
|
((eventName: 'click', callback: (event: Event) => void) => void) &
|
|
((eventName: 'close', callback: (event: Event) => void) => void) &
|
|
((
|
|
eventName: 'reply',
|
|
callback: (event: Event, reply: string) => void,
|
|
) => void) &
|
|
((
|
|
eventName: 'action',
|
|
callback: (event: Event, index: number) => void,
|
|
) => void);
|
|
once: ((eventName: 'show', callback: (event: Event) => void) => void) &
|
|
((eventName: 'click', callback: (event: Event) => void) => void) &
|
|
((eventName: 'close', callback: (event: Event) => void) => void) &
|
|
((
|
|
eventName: 'reply',
|
|
callback: (event: Event, reply: string) => void,
|
|
) => void) &
|
|
((
|
|
eventName: 'action',
|
|
callback: (event: Event, index: number) => void,
|
|
) => void);
|
|
}
|
|
declare class Session {
|
|
getCacheSize: (callback: Function) => void;
|
|
clearCache: (callback: Function) => void;
|
|
clearStorageData: ((
|
|
options?: ?{
|
|
origin?: ?string,
|
|
storages?: ?Array<string>,
|
|
quotas?: ?Array<string>,
|
|
},
|
|
callback?: ?Function,
|
|
) => void) &
|
|
((callback?: ?Function) => void);
|
|
flushStorageData: () => void;
|
|
setProxy: (
|
|
config: {
|
|
pacScript: string,
|
|
proxyRules: string,
|
|
proxyBypassRules: string,
|
|
},
|
|
callback: Function,
|
|
) => void;
|
|
resolveProxy: (url: URL, callback: Function) => void;
|
|
setDownloadPath: (path: string) => void;
|
|
enableNetworkEmulation: (options: {
|
|
offline?: ?boolean,
|
|
latency?: ?number,
|
|
downloadThroughput?: ?number,
|
|
uploadThroughput?: ?number,
|
|
}) => void;
|
|
disableNetworkEmulation: () => void;
|
|
setCertificateVerifyProc: (proc: Function) => void;
|
|
setPermissionRequestHandler: (handler: Function | null) => void;
|
|
setPermissionCheckHandler: (handler: Function | null) => void;
|
|
clearHostResolverCache: (callback?: ?Function) => void;
|
|
allowNTLMCredentialsForDomains: (domains: string) => void;
|
|
setUserAgent: (userAgent: string, acceptLanguages?: ?string) => void;
|
|
getUserAgent: () => string;
|
|
getBlobData: (identifier: string, callback: Function) => void;
|
|
createInterruptedDownload: (options: {
|
|
path: string,
|
|
urlChain: Array<string>,
|
|
mimeType?: ?string,
|
|
offset: number,
|
|
length: number,
|
|
lastModified: string,
|
|
eTag: string,
|
|
startTime?: ?number,
|
|
}) => void;
|
|
clearAuthCache: (
|
|
options: RemovePassword | RemoveClientCertificate,
|
|
callback?: ?Function,
|
|
) => void;
|
|
setPreloads: (preloads: Array<string>) => void;
|
|
getPreloads: () => Array<string>;
|
|
cookies: Cookies;
|
|
webRequest: WebRequest;
|
|
protocol: Protocol;
|
|
netLog: NetLog;
|
|
on: (
|
|
eventName: 'will-download',
|
|
callback: (
|
|
event: Event,
|
|
item: DownloadItem,
|
|
webContents: WebContents,
|
|
) => void,
|
|
) => void;
|
|
once: (
|
|
eventName: 'will-download',
|
|
callback: (
|
|
event: Event,
|
|
item: DownloadItem,
|
|
webContents: WebContents,
|
|
) => void,
|
|
) => void;
|
|
}
|
|
declare class TouchBar {
|
|
constructor(options: {
|
|
items: Array<
|
|
| TouchBarButton
|
|
| TouchBarColorPicker
|
|
| TouchBarGroup
|
|
| TouchBarLabel
|
|
| TouchBarPopover
|
|
| TouchBarScrubber
|
|
| TouchBarSegmentedControl
|
|
| TouchBarSlider
|
|
| TouchBarSpacer,
|
|
>,
|
|
escapeItem?:
|
|
| ?TouchBarButton
|
|
| TouchBarColorPicker
|
|
| TouchBarGroup
|
|
| TouchBarLabel
|
|
| TouchBarPopover
|
|
| TouchBarScrubber
|
|
| TouchBarSegmentedControl
|
|
| TouchBarSlider
|
|
| TouchBarSpacer
|
|
| null,
|
|
}): TouchBar;
|
|
static TouchBarButton: Class<TouchBarButton>;
|
|
static TouchBarColorPicker: Class<TouchBarColorPicker>;
|
|
static TouchBarGroup: Class<TouchBarGroup>;
|
|
static TouchBarLabel: Class<TouchBarLabel>;
|
|
static TouchBarPopover: Class<TouchBarPopover>;
|
|
static TouchBarScrubber: Class<TouchBarScrubber>;
|
|
static TouchBarSegmentedControl: Class<TouchBarSegmentedControl>;
|
|
static TouchBarSlider: Class<TouchBarSlider>;
|
|
static TouchBarSpacer: Class<TouchBarSpacer>;
|
|
escapeItem: TouchBarItem;
|
|
}
|
|
declare class Tray {
|
|
constructor(image: NativeImage | string): Tray;
|
|
destroy: () => void;
|
|
setImage: (image: NativeImage | string) => void;
|
|
setPressedImage: (image: NativeImage | string) => void;
|
|
setToolTip: (toolTip: string) => void;
|
|
setTitle: (title: string) => void;
|
|
setHighlightMode: (mode: 'selection' | 'always' | 'never') => void;
|
|
setIgnoreDoubleClickEvents: (ignore: boolean) => void;
|
|
getIgnoreDoubleClickEvents: () => boolean;
|
|
displayBalloon: (options: {
|
|
icon?: ?NativeImage | string,
|
|
title: string,
|
|
content: string,
|
|
}) => void;
|
|
popUpContextMenu: ((menu?: ?Menu, position?: ?Point) => void) &
|
|
((position?: ?Point) => void);
|
|
setContextMenu: (menu: Menu | null) => void;
|
|
getBounds: () => Rectangle;
|
|
isDestroyed: () => boolean;
|
|
on: ((
|
|
eventName: 'click',
|
|
callback: (event: Event, bounds: Rectangle, position: Point) => void,
|
|
) => void) &
|
|
((
|
|
eventName: 'right-click',
|
|
callback: (event: Event, bounds: Rectangle) => void,
|
|
) => void) &
|
|
((
|
|
eventName: 'double-click',
|
|
callback: (event: Event, bounds: Rectangle) => void,
|
|
) => void) &
|
|
((eventName: 'balloon-show', callback: () => void) => void) &
|
|
((eventName: 'balloon-click', callback: () => void) => void) &
|
|
((eventName: 'balloon-closed', callback: () => void) => void) &
|
|
((eventName: 'drop', callback: () => void) => void) &
|
|
((
|
|
eventName: 'drop-files',
|
|
callback: (event: Event, files: Array<string>) => void,
|
|
) => void) &
|
|
((
|
|
eventName: 'drop-text',
|
|
callback: (event: Event, text: string) => void,
|
|
) => void) &
|
|
((eventName: 'drag-enter', callback: () => void) => void) &
|
|
((eventName: 'drag-leave', callback: () => void) => void) &
|
|
((eventName: 'drag-end', callback: () => void) => void) &
|
|
((
|
|
eventName: 'mouse-enter',
|
|
callback: (event: Event, position: Point) => void,
|
|
) => void) &
|
|
((
|
|
eventName: 'mouse-leave',
|
|
callback: (event: Event, position: Point) => void,
|
|
) => void) &
|
|
((
|
|
eventName: 'mouse-move',
|
|
callback: (event: Event, position: Point) => void,
|
|
) => void);
|
|
once: ((
|
|
eventName: 'click',
|
|
callback: (event: Event, bounds: Rectangle, position: Point) => void,
|
|
) => void) &
|
|
((
|
|
eventName: 'right-click',
|
|
callback: (event: Event, bounds: Rectangle) => void,
|
|
) => void) &
|
|
((
|
|
eventName: 'double-click',
|
|
callback: (event: Event, bounds: Rectangle) => void,
|
|
) => void) &
|
|
((eventName: 'balloon-show', callback: () => void) => void) &
|
|
((eventName: 'balloon-click', callback: () => void) => void) &
|
|
((eventName: 'balloon-closed', callback: () => void) => void) &
|
|
((eventName: 'drop', callback: () => void) => void) &
|
|
((
|
|
eventName: 'drop-files',
|
|
callback: (event: Event, files: Array<string>) => void,
|
|
) => void) &
|
|
((
|
|
eventName: 'drop-text',
|
|
callback: (event: Event, text: string) => void,
|
|
) => void) &
|
|
((eventName: 'drag-enter', callback: () => void) => void) &
|
|
((eventName: 'drag-leave', callback: () => void) => void) &
|
|
((eventName: 'drag-end', callback: () => void) => void) &
|
|
((
|
|
eventName: 'mouse-enter',
|
|
callback: (event: Event, position: Point) => void,
|
|
) => void) &
|
|
((
|
|
eventName: 'mouse-leave',
|
|
callback: (event: Event, position: Point) => void,
|
|
) => void) &
|
|
((
|
|
eventName: 'mouse-move',
|
|
callback: (event: Event, position: Point) => void,
|
|
) => void);
|
|
}
|
|
declare class WebContents {
|
|
loadURL: (
|
|
url: string,
|
|
options?: ?{
|
|
httpReferrer?: ?string | Referrer,
|
|
userAgent?: ?string,
|
|
extraHeaders?: ?string,
|
|
postData?:
|
|
| ?Array<UploadRawData>
|
|
| Array<UploadFile>
|
|
| Array<UploadBlob>,
|
|
baseURLForDataURL?: ?string,
|
|
},
|
|
) => void;
|
|
loadFile: (
|
|
filePath: string,
|
|
options?: ?{
|
|
query?: ?{},
|
|
search?: ?string,
|
|
hash?: ?string,
|
|
},
|
|
) => void;
|
|
downloadURL: (url: string) => void;
|
|
getURL: () => string;
|
|
getTitle: () => string;
|
|
isDestroyed: () => boolean;
|
|
focus: () => void;
|
|
isFocused: () => boolean;
|
|
isLoading: () => boolean;
|
|
isLoadingMainFrame: () => boolean;
|
|
isWaitingForResponse: () => boolean;
|
|
stop: () => void;
|
|
reload: () => void;
|
|
reloadIgnoringCache: () => void;
|
|
canGoBack: () => boolean;
|
|
canGoForward: () => boolean;
|
|
canGoToOffset: (offset: number) => boolean;
|
|
clearHistory: () => void;
|
|
goBack: () => void;
|
|
goForward: () => void;
|
|
goToIndex: (index: number) => void;
|
|
goToOffset: (offset: number) => void;
|
|
isCrashed: () => boolean;
|
|
setUserAgent: (userAgent: string) => void;
|
|
getUserAgent: () => string;
|
|
insertCSS: (css: string) => void;
|
|
executeJavaScript: (
|
|
code: string,
|
|
userGesture?: ?boolean,
|
|
callback?: ?Function,
|
|
) => Promise<any>;
|
|
setIgnoreMenuShortcuts: (ignore: boolean) => void;
|
|
setAudioMuted: (muted: boolean) => void;
|
|
isAudioMuted: () => boolean;
|
|
isCurrentlyAudible: () => boolean;
|
|
setZoomFactor: (factor: number) => void;
|
|
getZoomFactor: (callback: Function) => void;
|
|
setZoomLevel: (level: number) => void;
|
|
getZoomLevel: (callback: Function) => void;
|
|
setVisualZoomLevelLimits: (
|
|
minimumLevel: number,
|
|
maximumLevel: number,
|
|
) => void;
|
|
setLayoutZoomLevelLimits: (
|
|
minimumLevel: number,
|
|
maximumLevel: number,
|
|
) => void;
|
|
undo: () => void;
|
|
redo: () => void;
|
|
cut: () => void;
|
|
copy: () => void;
|
|
copyImageAt: (x: number, y: number) => void;
|
|
paste: () => void;
|
|
pasteAndMatchStyle: () => void;
|
|
delete: () => void;
|
|
selectAll: () => void;
|
|
unselect: () => void;
|
|
replace: (text: string) => void;
|
|
replaceMisspelling: (text: string) => void;
|
|
insertText: (text: string) => void;
|
|
findInPage: (
|
|
text: string,
|
|
options?: ?{
|
|
forward?: ?boolean,
|
|
findNext?: ?boolean,
|
|
matchCase?: ?boolean,
|
|
wordStart?: ?boolean,
|
|
medialCapitalAsWordStart?: ?boolean,
|
|
},
|
|
) => number;
|
|
stopFindInPage: (
|
|
action: 'clearSelection' | 'keepSelection' | 'activateSelection',
|
|
) => void;
|
|
capturePage: ((rect?: ?Rectangle, callback: Function) => void) &
|
|
((callback: Function) => void);
|
|
hasServiceWorker: (callback: Function) => void;
|
|
unregisterServiceWorker: (callback: Function) => void;
|
|
getPrinters: () => Array<PrinterInfo>;
|
|
print: ((
|
|
options?: ?{
|
|
silent?: ?boolean,
|
|
printBackground?: ?boolean,
|
|
deviceName?: ?string,
|
|
},
|
|
callback?: ?Function,
|
|
) => void) &
|
|
((callback?: ?Function) => void);
|
|
printToPDF: (
|
|
options: {
|
|
marginsType?: ?number,
|
|
pageSize?: ?string | Size,
|
|
printBackground?: ?boolean,
|
|
printSelectionOnly?: ?boolean,
|
|
landscape?: ?boolean,
|
|
},
|
|
callback: Function,
|
|
) => void;
|
|
addWorkSpace: (path: string) => void;
|
|
removeWorkSpace: (path: string) => void;
|
|
setDevToolsWebContents: (devToolsWebContents: WebContents) => void;
|
|
openDevTools: (
|
|
options?: ?{
|
|
mode: 'right' | 'bottom' | 'undocked' | 'detach',
|
|
},
|
|
) => void;
|
|
closeDevTools: () => void;
|
|
isDevToolsOpened: () => boolean;
|
|
isDevToolsFocused: () => boolean;
|
|
toggleDevTools: () => void;
|
|
inspectElement: (x: number, y: number) => void;
|
|
inspectServiceWorker: () => void;
|
|
send: (channel: string, ...args: Array<any>) => void;
|
|
enableDeviceEmulation: (parameters: {
|
|
screenPosition: 'desktop' | 'mobile',
|
|
screenSize: Size,
|
|
viewPosition: Point,
|
|
deviceScaleFactor: number,
|
|
viewSize: Size,
|
|
scale: number,
|
|
}) => void;
|
|
disableDeviceEmulation: () => void;
|
|
sendInputEvent: (event: {
|
|
type:
|
|
| 'mouseDown'
|
|
| 'mouseUp'
|
|
| 'mouseEnter'
|
|
| 'mouseLeave'
|
|
| 'contextMenu'
|
|
| 'mouseWheel'
|
|
| 'mouseMove'
|
|
| 'keyDown'
|
|
| 'keyUp'
|
|
| 'char',
|
|
modifiers: Array<string>,
|
|
}) => void;
|
|
beginFrameSubscription: ((
|
|
onlyDirty?: ?boolean,
|
|
callback: Function,
|
|
) => void) &
|
|
((callback: Function) => void);
|
|
endFrameSubscription: () => void;
|
|
startDrag: (item: {
|
|
file: string,
|
|
icon: NativeImage,
|
|
}) => void;
|
|
savePage: (
|
|
fullPath: string,
|
|
saveType: 'HTMLOnly' | 'HTMLComplete' | 'MHTML',
|
|
callback: Function,
|
|
) => boolean;
|
|
showDefinitionForSelection: () => void;
|
|
isOffscreen: () => boolean;
|
|
startPainting: () => void;
|
|
stopPainting: () => void;
|
|
isPainting: () => boolean;
|
|
setFrameRate: (fps: number) => void;
|
|
getFrameRate: () => number;
|
|
invalidate: () => void;
|
|
getWebRTCIPHandlingPolicy: () => string;
|
|
setWebRTCIPHandlingPolicy: (
|
|
policy:
|
|
| 'default'
|
|
| 'default_public_interface_only'
|
|
| 'default_public_and_private_interfaces'
|
|
| 'disable_non_proxied_udp',
|
|
) => void;
|
|
getOSProcessId: () => number;
|
|
getProcessId: () => number;
|
|
takeHeapSnapshot: (filePath: string) => Promise<any>;
|
|
setBackgroundThrottling: (allowed: boolean) => void;
|
|
getType: () =>
|
|
| 'backgroundPage'
|
|
| 'window'
|
|
| 'browserView'
|
|
| 'remote'
|
|
| 'webview'
|
|
| 'offscreen';
|
|
id: number;
|
|
session: Session;
|
|
hostWebContents: WebContents;
|
|
devToolsWebContents: WebContents;
|
|
debugger: Debugger;
|
|
on: ((eventName: 'did-finish-load', callback: () => void) => void) &
|
|
((
|
|
eventName: 'did-fail-load',
|
|
callback: (
|
|
event: Event,
|
|
errorCode: number,
|
|
errorDescription: string,
|
|
validatedURL: string,
|
|
isMainFrame: boolean,
|
|
frameProcessId: number,
|
|
frameRoutingId: number,
|
|
) => void,
|
|
) => void) &
|
|
((
|
|
eventName: 'did-frame-finish-load',
|
|
callback: (
|
|
event: Event,
|
|
isMainFrame: boolean,
|
|
frameProcessId: number,
|
|
frameRoutingId: number,
|
|
) => void,
|
|
) => void) &
|
|
((eventName: 'did-start-loading', callback: () => void) => void) &
|
|
((eventName: 'did-stop-loading', callback: () => void) => void) &
|
|
((eventName: 'dom-ready', callback: (event: Event) => void) => void) &
|
|
((
|
|
eventName: 'page-favicon-updated',
|
|
callback: (event: Event, favicons: Array<string>) => void,
|
|
) => void) &
|
|
((
|
|
eventName: 'new-window',
|
|
callback: (
|
|
event: Event,
|
|
url: string,
|
|
frameName: string,
|
|
disposition:
|
|
| 'default'
|
|
| 'foreground-tab'
|
|
| 'background-tab'
|
|
| 'new-window'
|
|
| 'save-to-disk'
|
|
| 'other',
|
|
options: {},
|
|
additionalFeatures: Array<string>,
|
|
referrer: Referrer,
|
|
) => void,
|
|
) => void) &
|
|
((
|
|
eventName: 'will-navigate',
|
|
callback: (event: Event, url: string) => void,
|
|
) => void) &
|
|
((
|
|
eventName: 'did-start-navigation',
|
|
callback: (
|
|
event: Event,
|
|
url: string,
|
|
isInPlace: boolean,
|
|
isMainFrame: boolean,
|
|
frameProcessId: number,
|
|
frameRoutingId: number,
|
|
) => void,
|
|
) => void) &
|
|
((
|
|
eventName: 'will-redirect',
|
|
callback: (
|
|
event: Event,
|
|
url: string,
|
|
isInPlace: boolean,
|
|
isMainFrame: boolean,
|
|
frameProcessId: number,
|
|
frameRoutingId: number,
|
|
) => void,
|
|
) => void) &
|
|
((
|
|
eventName: 'did-redirect-navigation',
|
|
callback: (
|
|
event: Event,
|
|
url: string,
|
|
isInPlace: boolean,
|
|
isMainFrame: boolean,
|
|
frameProcessId: number,
|
|
frameRoutingId: number,
|
|
) => void,
|
|
) => void) &
|
|
((
|
|
eventName: 'did-navigate',
|
|
callback: (
|
|
event: Event,
|
|
url: string,
|
|
httpResponseCode: number,
|
|
httpStatusText: string,
|
|
) => void,
|
|
) => void) &
|
|
((
|
|
eventName: 'did-frame-navigate',
|
|
callback: (
|
|
event: Event,
|
|
url: string,
|
|
httpResponseCode: number,
|
|
httpStatusText: string,
|
|
isMainFrame: boolean,
|
|
frameProcessId: number,
|
|
frameRoutingId: number,
|
|
) => void,
|
|
) => void) &
|
|
((
|
|
eventName: 'did-navigate-in-page',
|
|
callback: (
|
|
event: Event,
|
|
url: string,
|
|
isMainFrame: boolean,
|
|
frameProcessId: number,
|
|
frameRoutingId: number,
|
|
) => void,
|
|
) => void) &
|
|
((
|
|
eventName: 'will-prevent-unload',
|
|
callback: (event: Event) => void,
|
|
) => void) &
|
|
((
|
|
eventName: 'crashed',
|
|
callback: (event: Event, killed: boolean) => void,
|
|
) => void) &
|
|
((eventName: 'unresponsive', callback: () => void) => void) &
|
|
((eventName: 'responsive', callback: () => void) => void) &
|
|
((
|
|
eventName: 'plugin-crashed',
|
|
callback: (event: Event, name: string, version: string) => void,
|
|
) => void) &
|
|
((eventName: 'destroyed', callback: () => void) => void) &
|
|
((
|
|
eventName: 'before-input-event',
|
|
callback: (
|
|
event: Event,
|
|
input: {
|
|
type: string,
|
|
key: string,
|
|
code: string,
|
|
isAutoRepeat: boolean,
|
|
shift: boolean,
|
|
control: boolean,
|
|
alt: boolean,
|
|
meta: boolean,
|
|
},
|
|
) => void,
|
|
) => void) &
|
|
((eventName: 'devtools-opened', callback: () => void) => void) &
|
|
((eventName: 'devtools-closed', callback: () => void) => void) &
|
|
((eventName: 'devtools-focused', callback: () => void) => void) &
|
|
((
|
|
eventName: 'certificate-error',
|
|
callback: (
|
|
event: Event,
|
|
url: string,
|
|
error: string,
|
|
certificate: Certificate,
|
|
callback: Function,
|
|
) => void,
|
|
) => void) &
|
|
((
|
|
eventName: 'select-client-certificate',
|
|
callback: (
|
|
event: Event,
|
|
url: URL,
|
|
certificateList: Array<Certificate>,
|
|
callback: Function,
|
|
) => void,
|
|
) => void) &
|
|
((
|
|
eventName: 'login',
|
|
callback: (
|
|
event: Event,
|
|
request: {
|
|
method: string,
|
|
url: URL,
|
|
referrer: URL,
|
|
},
|
|
authInfo: {
|
|
isProxy: boolean,
|
|
scheme: string,
|
|
host: string,
|
|
port: number,
|
|
realm: string,
|
|
},
|
|
callback: Function,
|
|
) => void,
|
|
) => void) &
|
|
((
|
|
eventName: 'found-in-page',
|
|
callback: (
|
|
event: Event,
|
|
result: {
|
|
requestId: number,
|
|
activeMatchOrdinal: number,
|
|
matches: number,
|
|
selectionArea: {},
|
|
finalUpdate: boolean,
|
|
},
|
|
) => void,
|
|
) => void) &
|
|
((eventName: 'media-started-playing', callback: () => void) => void) &
|
|
((eventName: 'media-paused', callback: () => void) => void) &
|
|
((
|
|
eventName: 'did-change-theme-color',
|
|
callback: (event: Event, color: string | null) => void,
|
|
) => void) &
|
|
((
|
|
eventName: 'update-target-url',
|
|
callback: (event: Event, url: string) => void,
|
|
) => void) &
|
|
((
|
|
eventName: 'cursor-changed',
|
|
callback: (
|
|
event: Event,
|
|
type: string,
|
|
image?: ?NativeImage,
|
|
scale?: ?number,
|
|
size?: ?Size,
|
|
hotspot?: ?Point,
|
|
) => void,
|
|
) => void) &
|
|
((
|
|
eventName: 'context-menu',
|
|
callback: (
|
|
event: Event,
|
|
params: {
|
|
x: number,
|
|
y: number,
|
|
linkURL: string,
|
|
linkText: string,
|
|
pageURL: string,
|
|
frameURL: string,
|
|
srcURL: string,
|
|
mediaType:
|
|
| 'none'
|
|
| 'image'
|
|
| 'audio'
|
|
| 'video'
|
|
| 'canvas'
|
|
| 'file'
|
|
| 'plugin',
|
|
hasImageContents: boolean,
|
|
isEditable: boolean,
|
|
selectionText: string,
|
|
titleText: string,
|
|
misspelledWord: string,
|
|
frameCharset: string,
|
|
inputFieldType: string,
|
|
menuSourceType:
|
|
| 'none'
|
|
| 'mouse'
|
|
| 'keyboard'
|
|
| 'touch'
|
|
| 'touchMenu',
|
|
mediaFlags: {
|
|
inError: boolean,
|
|
isPaused: boolean,
|
|
isMuted: boolean,
|
|
hasAudio: boolean,
|
|
isLooping: boolean,
|
|
isControlsVisible: boolean,
|
|
canToggleControls: boolean,
|
|
canRotate: boolean,
|
|
},
|
|
editFlags: {
|
|
canUndo: boolean,
|
|
canRedo: boolean,
|
|
canCut: boolean,
|
|
canCopy: boolean,
|
|
canPaste: boolean,
|
|
canDelete: boolean,
|
|
canSelectAll: boolean,
|
|
},
|
|
},
|
|
) => void,
|
|
) => void) &
|
|
((
|
|
eventName: 'select-bluetooth-device',
|
|
callback: (
|
|
event: Event,
|
|
devices: Array<BluetoothDevice>,
|
|
callback: Function,
|
|
) => void,
|
|
) => void) &
|
|
((
|
|
eventName: 'paint',
|
|
callback: (
|
|
event: Event,
|
|
dirtyRect: Rectangle,
|
|
image: NativeImage,
|
|
) => void,
|
|
) => void) &
|
|
((eventName: 'devtools-reload-page', callback: () => void) => void) &
|
|
((
|
|
eventName: 'will-attach-webview',
|
|
callback: (event: Event, webPreferences: {}, params: {}) => void,
|
|
) => void) &
|
|
((
|
|
eventName: 'did-attach-webview',
|
|
callback: (event: Event, webContents: WebContents) => void,
|
|
) => void) &
|
|
((
|
|
eventName: 'console-message',
|
|
callback: (
|
|
event: Event,
|
|
level: number,
|
|
message: string,
|
|
line: number,
|
|
sourceId: string,
|
|
) => void,
|
|
) => void) &
|
|
((
|
|
eventName: 'remote-require',
|
|
callback: (event: Event, moduleName: string) => void,
|
|
) => void) &
|
|
((
|
|
eventName: 'remote-get-global',
|
|
callback: (event: Event, globalName: string) => void,
|
|
) => void) &
|
|
((
|
|
eventName: 'remote-get-builtin',
|
|
callback: (event: Event, moduleName: string) => void,
|
|
) => void) &
|
|
((
|
|
eventName: 'remote-get-current-window',
|
|
callback: (event: Event) => void,
|
|
) => void) &
|
|
((
|
|
eventName: 'remote-get-current-web-contents',
|
|
callback: (event: Event) => void,
|
|
) => void) &
|
|
((
|
|
eventName: 'remote-get-guest-web-contents',
|
|
callback: (event: Event, guestWebContents: WebContents) => void,
|
|
) => void);
|
|
once: ((eventName: 'did-finish-load', callback: () => void) => void) &
|
|
((
|
|
eventName: 'did-fail-load',
|
|
callback: (
|
|
event: Event,
|
|
errorCode: number,
|
|
errorDescription: string,
|
|
validatedURL: string,
|
|
isMainFrame: boolean,
|
|
frameProcessId: number,
|
|
frameRoutingId: number,
|
|
) => void,
|
|
) => void) &
|
|
((
|
|
eventName: 'did-frame-finish-load',
|
|
callback: (
|
|
event: Event,
|
|
isMainFrame: boolean,
|
|
frameProcessId: number,
|
|
frameRoutingId: number,
|
|
) => void,
|
|
) => void) &
|
|
((eventName: 'did-start-loading', callback: () => void) => void) &
|
|
((eventName: 'did-stop-loading', callback: () => void) => void) &
|
|
((eventName: 'dom-ready', callback: (event: Event) => void) => void) &
|
|
((
|
|
eventName: 'page-favicon-updated',
|
|
callback: (event: Event, favicons: Array<string>) => void,
|
|
) => void) &
|
|
((
|
|
eventName: 'new-window',
|
|
callback: (
|
|
event: Event,
|
|
url: string,
|
|
frameName: string,
|
|
disposition:
|
|
| 'default'
|
|
| 'foreground-tab'
|
|
| 'background-tab'
|
|
| 'new-window'
|
|
| 'save-to-disk'
|
|
| 'other',
|
|
options: {},
|
|
additionalFeatures: Array<string>,
|
|
referrer: Referrer,
|
|
) => void,
|
|
) => void) &
|
|
((
|
|
eventName: 'will-navigate',
|
|
callback: (event: Event, url: string) => void,
|
|
) => void) &
|
|
((
|
|
eventName: 'did-start-navigation',
|
|
callback: (
|
|
event: Event,
|
|
url: string,
|
|
isInPlace: boolean,
|
|
isMainFrame: boolean,
|
|
frameProcessId: number,
|
|
frameRoutingId: number,
|
|
) => void,
|
|
) => void) &
|
|
((
|
|
eventName: 'will-redirect',
|
|
callback: (
|
|
event: Event,
|
|
url: string,
|
|
isInPlace: boolean,
|
|
isMainFrame: boolean,
|
|
frameProcessId: number,
|
|
frameRoutingId: number,
|
|
) => void,
|
|
) => void) &
|
|
((
|
|
eventName: 'did-redirect-navigation',
|
|
callback: (
|
|
event: Event,
|
|
url: string,
|
|
isInPlace: boolean,
|
|
isMainFrame: boolean,
|
|
frameProcessId: number,
|
|
frameRoutingId: number,
|
|
) => void,
|
|
) => void) &
|
|
((
|
|
eventName: 'did-navigate',
|
|
callback: (
|
|
event: Event,
|
|
url: string,
|
|
httpResponseCode: number,
|
|
httpStatusText: string,
|
|
) => void,
|
|
) => void) &
|
|
((
|
|
eventName: 'did-frame-navigate',
|
|
callback: (
|
|
event: Event,
|
|
url: string,
|
|
httpResponseCode: number,
|
|
httpStatusText: string,
|
|
isMainFrame: boolean,
|
|
frameProcessId: number,
|
|
frameRoutingId: number,
|
|
) => void,
|
|
) => void) &
|
|
((
|
|
eventName: 'did-navigate-in-page',
|
|
callback: (
|
|
event: Event,
|
|
url: string,
|
|
isMainFrame: boolean,
|
|
frameProcessId: number,
|
|
frameRoutingId: number,
|
|
) => void,
|
|
) => void) &
|
|
((
|
|
eventName: 'will-prevent-unload',
|
|
callback: (event: Event) => void,
|
|
) => void) &
|
|
((
|
|
eventName: 'crashed',
|
|
callback: (event: Event, killed: boolean) => void,
|
|
) => void) &
|
|
((eventName: 'unresponsive', callback: () => void) => void) &
|
|
((eventName: 'responsive', callback: () => void) => void) &
|
|
((
|
|
eventName: 'plugin-crashed',
|
|
callback: (event: Event, name: string, version: string) => void,
|
|
) => void) &
|
|
((eventName: 'destroyed', callback: () => void) => void) &
|
|
((
|
|
eventName: 'before-input-event',
|
|
callback: (
|
|
event: Event,
|
|
input: {
|
|
type: string,
|
|
key: string,
|
|
code: string,
|
|
isAutoRepeat: boolean,
|
|
shift: boolean,
|
|
control: boolean,
|
|
alt: boolean,
|
|
meta: boolean,
|
|
},
|
|
) => void,
|
|
) => void) &
|
|
((eventName: 'devtools-opened', callback: () => void) => void) &
|
|
((eventName: 'devtools-closed', callback: () => void) => void) &
|
|
((eventName: 'devtools-focused', callback: () => void) => void) &
|
|
((
|
|
eventName: 'certificate-error',
|
|
callback: (
|
|
event: Event,
|
|
url: string,
|
|
error: string,
|
|
certificate: Certificate,
|
|
callback: Function,
|
|
) => void,
|
|
) => void) &
|
|
((
|
|
eventName: 'select-client-certificate',
|
|
callback: (
|
|
event: Event,
|
|
url: URL,
|
|
certificateList: Array<Certificate>,
|
|
callback: Function,
|
|
) => void,
|
|
) => void) &
|
|
((
|
|
eventName: 'login',
|
|
callback: (
|
|
event: Event,
|
|
request: {
|
|
method: string,
|
|
url: URL,
|
|
referrer: URL,
|
|
},
|
|
authInfo: {
|
|
isProxy: boolean,
|
|
scheme: string,
|
|
host: string,
|
|
port: number,
|
|
realm: string,
|
|
},
|
|
callback: Function,
|
|
) => void,
|
|
) => void) &
|
|
((
|
|
eventName: 'found-in-page',
|
|
callback: (
|
|
event: Event,
|
|
result: {
|
|
requestId: number,
|
|
activeMatchOrdinal: number,
|
|
matches: number,
|
|
selectionArea: {},
|
|
finalUpdate: boolean,
|
|
},
|
|
) => void,
|
|
) => void) &
|
|
((eventName: 'media-started-playing', callback: () => void) => void) &
|
|
((eventName: 'media-paused', callback: () => void) => void) &
|
|
((
|
|
eventName: 'did-change-theme-color',
|
|
callback: (event: Event, color: string | null) => void,
|
|
) => void) &
|
|
((
|
|
eventName: 'update-target-url',
|
|
callback: (event: Event, url: string) => void,
|
|
) => void) &
|
|
((
|
|
eventName: 'cursor-changed',
|
|
callback: (
|
|
event: Event,
|
|
type: string,
|
|
image?: ?NativeImage,
|
|
scale?: ?number,
|
|
size?: ?Size,
|
|
hotspot?: ?Point,
|
|
) => void,
|
|
) => void) &
|
|
((
|
|
eventName: 'context-menu',
|
|
callback: (
|
|
event: Event,
|
|
params: {
|
|
x: number,
|
|
y: number,
|
|
linkURL: string,
|
|
linkText: string,
|
|
pageURL: string,
|
|
frameURL: string,
|
|
srcURL: string,
|
|
mediaType:
|
|
| 'none'
|
|
| 'image'
|
|
| 'audio'
|
|
| 'video'
|
|
| 'canvas'
|
|
| 'file'
|
|
| 'plugin',
|
|
hasImageContents: boolean,
|
|
isEditable: boolean,
|
|
selectionText: string,
|
|
titleText: string,
|
|
misspelledWord: string,
|
|
frameCharset: string,
|
|
inputFieldType: string,
|
|
menuSourceType:
|
|
| 'none'
|
|
| 'mouse'
|
|
| 'keyboard'
|
|
| 'touch'
|
|
| 'touchMenu',
|
|
mediaFlags: {
|
|
inError: boolean,
|
|
isPaused: boolean,
|
|
isMuted: boolean,
|
|
hasAudio: boolean,
|
|
isLooping: boolean,
|
|
isControlsVisible: boolean,
|
|
canToggleControls: boolean,
|
|
canRotate: boolean,
|
|
},
|
|
editFlags: {
|
|
canUndo: boolean,
|
|
canRedo: boolean,
|
|
canCut: boolean,
|
|
canCopy: boolean,
|
|
canPaste: boolean,
|
|
canDelete: boolean,
|
|
canSelectAll: boolean,
|
|
},
|
|
},
|
|
) => void,
|
|
) => void) &
|
|
((
|
|
eventName: 'select-bluetooth-device',
|
|
callback: (
|
|
event: Event,
|
|
devices: Array<BluetoothDevice>,
|
|
callback: Function,
|
|
) => void,
|
|
) => void) &
|
|
((
|
|
eventName: 'paint',
|
|
callback: (
|
|
event: Event,
|
|
dirtyRect: Rectangle,
|
|
image: NativeImage,
|
|
) => void,
|
|
) => void) &
|
|
((eventName: 'devtools-reload-page', callback: () => void) => void) &
|
|
((
|
|
eventName: 'will-attach-webview',
|
|
callback: (event: Event, webPreferences: {}, params: {}) => void,
|
|
) => void) &
|
|
((
|
|
eventName: 'did-attach-webview',
|
|
callback: (event: Event, webContents: WebContents) => void,
|
|
) => void) &
|
|
((
|
|
eventName: 'console-message',
|
|
callback: (
|
|
event: Event,
|
|
level: number,
|
|
message: string,
|
|
line: number,
|
|
sourceId: string,
|
|
) => void,
|
|
) => void) &
|
|
((
|
|
eventName: 'remote-require',
|
|
callback: (event: Event, moduleName: string) => void,
|
|
) => void) &
|
|
((
|
|
eventName: 'remote-get-global',
|
|
callback: (event: Event, globalName: string) => void,
|
|
) => void) &
|
|
((
|
|
eventName: 'remote-get-builtin',
|
|
callback: (event: Event, moduleName: string) => void,
|
|
) => void) &
|
|
((
|
|
eventName: 'remote-get-current-window',
|
|
callback: (event: Event) => void,
|
|
) => void) &
|
|
((
|
|
eventName: 'remote-get-current-web-contents',
|
|
callback: (event: Event) => void,
|
|
) => void) &
|
|
((
|
|
eventName: 'remote-get-guest-web-contents',
|
|
callback: (event: Event, guestWebContents: WebContents) => void,
|
|
) => void);
|
|
}
|
|
declare class WebRequest {
|
|
onBeforeRequest: ((
|
|
filter?: ?{
|
|
urls: Array<string>,
|
|
},
|
|
listener: Function,
|
|
) => void) &
|
|
((listener: Function) => void);
|
|
onBeforeSendHeaders: ((
|
|
filter?: ?{
|
|
urls: Array<string>,
|
|
},
|
|
listener: Function,
|
|
) => void) &
|
|
((listener: Function) => void);
|
|
onSendHeaders: ((
|
|
filter?: ?{
|
|
urls: Array<string>,
|
|
},
|
|
listener: Function,
|
|
) => void) &
|
|
((listener: Function) => void);
|
|
onHeadersReceived: ((
|
|
filter?: ?{
|
|
urls: Array<string>,
|
|
},
|
|
listener: Function,
|
|
) => void) &
|
|
((listener: Function) => void);
|
|
onResponseStarted: ((
|
|
filter?: ?{
|
|
urls: Array<string>,
|
|
},
|
|
listener: Function,
|
|
) => void) &
|
|
((listener: Function) => void);
|
|
onBeforeRedirect: ((
|
|
filter?: ?{
|
|
urls: Array<string>,
|
|
},
|
|
listener: Function,
|
|
) => void) &
|
|
((listener: Function) => void);
|
|
onCompleted: ((
|
|
filter?: ?{
|
|
urls: Array<string>,
|
|
},
|
|
listener: Function,
|
|
) => void) &
|
|
((listener: Function) => void);
|
|
onErrorOccurred: ((
|
|
filter?: ?{
|
|
urls: Array<string>,
|
|
},
|
|
listener: Function,
|
|
) => void) &
|
|
((listener: Function) => void);
|
|
}
|
|
declare class TouchBarButton {
|
|
constructor(options: {
|
|
label?: ?string,
|
|
backgroundColor?: ?string,
|
|
icon?: ?NativeImage,
|
|
iconPosition?: ?'left' | 'right' | 'overlay',
|
|
click?: ?Function,
|
|
}): TouchBarButton;
|
|
label: string;
|
|
backgroundColor: string;
|
|
icon: NativeImage;
|
|
}
|
|
declare class TouchBarColorPicker {
|
|
constructor(options: {
|
|
availableColors?: ?Array<string>,
|
|
selectedColor?: ?string,
|
|
change?: ?Function,
|
|
}): TouchBarColorPicker;
|
|
availableColors: Array<string>;
|
|
selectedColor: string;
|
|
}
|
|
declare class TouchBarGroup {
|
|
constructor(options: {
|
|
items: TouchBar,
|
|
}): TouchBarGroup;
|
|
}
|
|
declare class TouchBarLabel {
|
|
constructor(options: {
|
|
label?: ?string,
|
|
textColor?: ?string,
|
|
}): TouchBarLabel;
|
|
label: string;
|
|
textColor: string;
|
|
}
|
|
declare class TouchBarPopover {
|
|
constructor(options: {
|
|
label?: ?string,
|
|
icon?: ?NativeImage,
|
|
items?: ?TouchBar,
|
|
showCloseButton?: ?boolean,
|
|
}): TouchBarPopover;
|
|
label: string;
|
|
icon: NativeImage;
|
|
}
|
|
declare class TouchBarScrubber {
|
|
constructor(options: {
|
|
items: Array<ScrubberItem>,
|
|
select: Function,
|
|
highlight: Function,
|
|
selectedStyle: string,
|
|
overlayStyle: string,
|
|
showArrowButtons: boolean,
|
|
mode: string,
|
|
continuous: boolean,
|
|
}): TouchBarScrubber;
|
|
items: Array<ScrubberItem>;
|
|
selectedStyle: string;
|
|
overlayStyle: string;
|
|
showArrowButtons: boolean;
|
|
mode: string;
|
|
continuous: boolean;
|
|
}
|
|
declare class TouchBarSegmentedControl {
|
|
constructor(options: {
|
|
segmentStyle?:
|
|
| ?'automatic'
|
|
| 'rounded'
|
|
| 'textured-rounded'
|
|
| 'round-rect'
|
|
| 'textured-square'
|
|
| 'capsule'
|
|
| 'small-square'
|
|
| 'separated',
|
|
mode?: ?'single' | 'multiple' | 'buttons',
|
|
segments: Array<SegmentedControlSegment>,
|
|
selectedIndex?: ?number,
|
|
change: Function,
|
|
}): TouchBarSegmentedControl;
|
|
segmentStyle: string;
|
|
segments: Array<SegmentedControlSegment>;
|
|
selectedIndex: number;
|
|
}
|
|
declare class TouchBarSlider {
|
|
constructor(options: {
|
|
label?: ?string,
|
|
value?: ?number,
|
|
minValue?: ?number,
|
|
maxValue?: ?number,
|
|
change?: ?Function,
|
|
}): TouchBarSlider;
|
|
label: string;
|
|
value: number;
|
|
minValue: number;
|
|
maxValue: number;
|
|
}
|
|
declare class TouchBarSpacer {
|
|
constructor(options: {
|
|
size?: ?'small' | 'large' | 'flexible',
|
|
}): TouchBarSpacer;
|
|
}
|
|
declare type Accelerator = any;
|
|
declare type WebFrame = any;
|
|
declare type ReadableStream = any;
|
|
declare type MenuItemConstructorOptions = any;
|
|
declare type Protocol = any;
|
|
declare type NetLog = any;
|
|
declare type TouchBarItem = any;
|
|
}
|