diff --git a/flow-typed/npm/electron-v3.0.0-beta.4.js b/flow-typed/npm/electron-v3.0.0-beta.4.js new file mode 100644 index 000000000..f585fe7bc --- /dev/null +++ b/flow-typed/npm/electron-v3.0.0-beta.4.js @@ -0,0 +1,3745 @@ +/** + * 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-v3.0.0-beta.4 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, + 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, + getUploadToServer: () => boolean, + setUploadToServer: (uploadToServer: boolean) => void, + addExtraParameter: (key: string, value: string) => void, + removeExtraParameter: (key: string) => void, + getParameters: () => void, + }, + desktopCapturer: { + getSources: ( + options: { + types: Array, + 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) => void, + sendSync: (channel: string, ...args: Array) => any, + sendTo: (windowId: number, channel: string, ...args: Array) => void, + sendToHost: (channel: string, ...args: Array) => 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, + ) => NativeImage, + }, + process: { + crash: () => void, + getCPUUsage: () => CPUUsage, + getIOCounters: () => IOCounters, + getHeapStatistics: () => { + totalHeapSize: number, + totalHeapSizeExecutable: number, + totalPhysicalSize: number, + totalAvailableSize: number, + usedHeapSize: number, + heapSizeLimit: number, + mallocedMemory: number, + peakMallocedMemory: number, + doesZapGarbage: boolean, + }, + getProcessMemoryInfo: () => { + workingSetSize: number, + peakWorkingSetSize: number, + privateBytes: number, + sharedBytes: number, + }, + getSystemMemoryInfo: () => { + total: number, + free: number, + swapTotal: number, + swapFree: number, + }, + 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, + 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, + execPath?: ?string, + }, + ) => void, + isReady: () => boolean, + whenReady: () => Promise, + 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, + ) => boolean, + removeAsDefaultProtocolClient: ( + protocol: string, + path?: ?string, + args?: ?Array, + ) => boolean, + isDefaultProtocolClient: ( + protocol: string, + path?: ?string, + args?: ?Array, + ) => boolean, + setUserTasks: (tasks: Array) => boolean, + getJumpListSettings: () => { + minItems: number, + removedItems: Array, + }, + setJumpList: (categories: Array) => 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, + getGPUFeatureStatus: () => GPUFeatureStatus, + setBadgeCount: (count: number) => boolean, + getBadgeCount: () => number, + isUnityRunning: () => boolean, + getLoginItemSettings: ( + options?: ?{ + path?: ?string, + args?: ?Array, + }, + ) => { + options?: ?{ + path?: ?string, + args?: ?Array, + }, + openAtLogin: boolean, + openAsHidden: boolean, + wasOpenedAtLogin: boolean, + wasOpenedAsHidden: boolean, + restoreState: boolean, + }, + setLoginItemSettings: (settings: { + openAtLogin?: ?boolean, + openAsHidden?: ?boolean, + path?: ?string, + args?: ?Array, + }) => void, + isAccessibilitySupportEnabled: () => boolean, + setAccessibilitySupportEnabled: (enabled: boolean) => void, + setAboutPanelOptions: (options: { + applicationName?: ?string, + applicationVersion?: ?string, + copyright?: ?string, + credits?: ?string, + version?: ?string, + }) => void, + startAccessingSecurityScopedResource: ( + bookmarkData: string, + ) => Function, + 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, + 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: (event: Event, session: Session) => void, + ) => void) & + (( + eventName: 'second-instance', + callback: ( + event: Event, + argv: Array, + workingDirectory: string, + ) => 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, + 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: (event: Event, session: Session) => void, + ) => void) & + (( + eventName: 'second-instance', + callback: ( + event: Event, + argv: Array, + workingDirectory: string, + ) => 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, + 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: { + categoryFilter: string, + traceOptions: string, + }, + 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, + 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, + properties?: ?Array< + | 'openFile' + | 'openDirectory' + | 'multiSelections' + | 'showHiddenFiles' + | 'createDirectory' + | 'promptToCreate' + | 'noResolveAliases' + | 'treatPackageAsDirectory', + >, + message?: ?string, + securityScopedBookmarks?: ?boolean, + }, + callback?: ?Function, + ) => Array) & + (( + options: { + title?: ?string, + defaultPath?: ?string, + buttonLabel?: ?string, + filters?: ?Array, + properties?: ?Array< + | 'openFile' + | 'openDirectory' + | 'multiSelections' + | 'showHiddenFiles' + | 'createDirectory' + | 'promptToCreate' + | 'noResolveAliases' + | 'treatPackageAsDirectory', + >, + message?: ?string, + securityScopedBookmarks?: ?boolean, + }, + callback?: ?Function, + ) => Array), + showSaveDialog: (( + browserWindow?: ?BrowserWindow, + options: { + title?: ?string, + defaultPath?: ?string, + buttonLabel?: ?string, + filters?: ?Array, + message?: ?string, + nameFieldLabel?: ?string, + showsTagField?: ?boolean, + securityScopedBookmarks?: ?boolean, + }, + callback?: ?Function, + ) => string) & + (( + options: { + title?: ?string, + defaultPath?: ?string, + buttonLabel?: ?string, + filters?: ?Array, + message?: ?string, + nameFieldLabel?: ?string, + showsTagField?: ?boolean, + securityScopedBookmarks?: ?boolean, + }, + callback?: ?Function, + ) => string), + showMessageBox: (( + browserWindow?: ?BrowserWindow, + options: { + type?: ?string, + buttons?: ?Array, + 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, + 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, callback: Function) => void, + canMakePayments: () => boolean, + getReceiptURL: () => string, + finishAllTransactions: () => void, + finishTransactionByDate: (date: string) => void, + on: ( + eventName: 'transactions-updated', + callback: (event: Event, transactions: Array) => void, + ) => void, + once: ( + eventName: 'transactions-updated', + callback: (event: Event, transactions: Array) => 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, + ) => 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, + getCPUUsage: () => CPUUsage, + getIOCounters: () => IOCounters, + getHeapStatistics: () => { + totalHeapSize: number, + totalHeapSizeExecutable: number, + totalPhysicalSize: number, + totalAvailableSize: number, + usedHeapSize: number, + heapSizeLimit: number, + mallocedMemory: number, + peakMallocedMemory: number, + doesZapGarbage: boolean, + }, + getProcessMemoryInfo: () => { + workingSetSize: number, + peakWorkingSetSize: number, + privateBytes: number, + sharedBytes: number, + }, + getSystemMemoryInfo: () => { + total: number, + free: number, + swapTotal: number, + swapFree: number, + }, + 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, + throwDeprecation?: ?boolean, + traceDeprecation?: ?boolean, + traceProcessWarnings?: ?boolean, + type?: ?string, + windowsStore?: ?boolean, + versions: { + chrome?: ?string, + electron?: ?string, + }, + }, + protocol: { + registerStandardSchemes: ( + schemes: Array, + options?: ?{ + secure?: ?boolean, + }, + ) => void, + registerServiceWorkerSchemes: (schemes: Array) => 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, + getDisplayNearestPoint: (point: Point) => Display, + getDisplayMatching: (rect: Rectangle) => Display, + screenToDipPoint: (point: Point) => Point, + dipToScreenPoint: (point: Point) => Point, + screenToDipRect: (window: BrowserWindow, rect: Rectangle) => Rectangle, + dipToScreenRect: (window: BrowserWindow, 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, + ) => 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, + ) => 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, + }, + 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) => void, + subscribeLocalNotification: (event: string, callback: Function) => void, + 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, + 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), + 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), + }, + webContents: { + getAllWebContents: () => Array, + getFocusedWebContents: () => WebContents, + fromId: (id: number) => WebContents, + }, + BrowserView: Class, + BrowserWindow: Class, + ClientRequest: Class, + Cookies: Class, + Debugger: Class, + DownloadItem: Class, + IncomingMessage: Class, + Menu: Class, + MenuItem: Class, + NativeImage: Class, + Notification: Class, + Session: Class, + TouchBar: Class, + Tray: Class, + WebContents: Class, + WebRequest: Class, + }, + screen: { + getCursorScreenPoint: () => Point, + getPrimaryDisplay: () => Display, + getAllDisplays: () => Array, + getDisplayNearestPoint: (point: Point) => Display, + getDisplayMatching: (rect: Rectangle) => Display, + screenToDipPoint: (point: Point) => Point, + dipToScreenPoint: (point: Point) => Point, + screenToDipRect: (window: BrowserWindow, rect: Rectangle) => Rectangle, + dipToScreenRect: (window: BrowserWindow, 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, + ) => 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, + ) => void, + ) => void), + }, + shell: { + showItemInFolder: (fullPath: string) => boolean, + openItem: (fullPath: string) => boolean, + openExternal: ( + url: string, + options?: ?{ + activate: boolean, + }, + 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, + executeJavaScriptInIsolatedWorld: ( + worldId: number, + scripts: Array, + 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, + 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, + NativeImage: Class, + }; + 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, + organizationUnits: Array, + 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, + }; + 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, + }; + 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, + memory: MemoryInfo, + cpu: CPUUsage, + }; + declare type Product = { + productIdentifier: string, + localizedDescription: string, + localizedTitle: string, + contentVersion: string, + contentLengths: Array, + 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, + }; + 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 + | Array + | Array, + baseURLForDataURL?: ?string, + }, + ) => void; + getURL: () => string; + getTitle: () => string; + isLoading: () => 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; + 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, + printBackground?: ?boolean, + printSelectionOnly?: ?boolean, + landscape?: ?boolean, + }, + callback: Function, + ) => void; + capturePage: ((rect?: ?Rectangle, callback: Function) => void) & + ((callback: Function) => void); + send: (channel: string, ...args: Array) => void; + sendInputEvent: (event: {}) => void; + setZoomFactor: (factor: number) => void; + setZoomLevel: (level: 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) => 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) => 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) => 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) => 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; + 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, + 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, + experimentalCanvasFeatures?: ?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, + safeDialogs?: ?boolean, + safeDialogsMessage?: ?string, + navigateOnDragDrop?: ?boolean, + }, + }, + ) => BrowserWindow; + static getAllWindows: () => Array; + 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; + setAspectRatio: (aspectRatio: number, extraSize: Size) => 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; + setEnabled: (enable: boolean) => void; + setSize: (width: number, height: number, animate?: ?boolean) => void; + getSize: () => Array; + setContentSize: (width: number, height: number, animate?: ?boolean) => void; + getContentSize: () => Array; + setMinimumSize: (width: number, height: number) => void; + getMinimumSize: () => Array; + setMaximumSize: (width: number, height: number) => void; + getMaximumSize: () => Array; + 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; + 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 + | Array + | Array, + baseURLForDataURL?: ?string, + }, + ) => void; + loadFile: (filePath: 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; + setThumbarButtons: (buttons: Array) => 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; + setAutoHideMenuBar: (hide: boolean) => void; + isMenuBarAutoHide: () => boolean; + setMenuBarVisibility: (visible: boolean) => void; + isMenuBarVisible: () => boolean; + setVisibleOnAllWorkspaces: (visible: 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; + 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: 'resize', callback: () => 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: '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: 'resize', callback: () => 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: '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; + 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; + 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, + ) => 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; + 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, + submenu?: ?Array | Menu, + id?: ?string, + position?: ?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, + 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, + quotas?: ?Array, + }, + 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; + 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, + mimeType?: ?string, + offset: number, + length: number, + lastModified: string, + eTag: string, + startTime?: ?number, + }) => void; + clearAuthCache: ( + options: RemovePassword | RemoveClientCertificate, + callback?: ?Function, + ) => void; + setPreloads: (preloads: Array) => void; + getPreloads: () => Array; + cookies: Cookies; + webRequest: WebRequest; + protocol: Protocol; + 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; + static TouchBarColorPicker: Class; + static TouchBarGroup: Class; + static TouchBarLabel: Class; + static TouchBarPopover: Class; + static TouchBarScrubber: Class; + static TouchBarSegmentedControl: Class; + static TouchBarSlider: Class; + static TouchBarSpacer: Class; + 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) => 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) => 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) => 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 + | Array + | Array, + baseURLForDataURL?: ?string, + }, + ) => void; + loadFile: (filePath: 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; + setIgnoreMenuShortcuts: (ignore: boolean) => void; + setAudioMuted: (muted: boolean) => void; + isAudioMuted: () => 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; + print: (( + options?: ?{ + silent?: ?boolean, + printBackground?: ?boolean, + deviceName?: ?string, + }, + callback?: ?Function, + ) => void) & + ((callback?: ?Function) => void); + printToPDF: ( + options: { + marginsType?: ?number, + pageSize?: ?string, + 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) => 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, + }) => 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; + setSize: (options: { + enableAutoSize?: ?boolean, + normal?: ?Size, + min?: ?Size, + max?: ?Size, + }) => 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; + 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) => 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, + referrer: Referrer, + ) => void, + ) => void) & + (( + eventName: 'will-navigate', + callback: (event: Event, url: string) => void, + ) => void) & + (( + eventName: 'did-start-navigation', + callback: ( + 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, + 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, + 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); + 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) => 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, + referrer: Referrer, + ) => void, + ) => void) & + (( + eventName: 'will-navigate', + callback: (event: Event, url: string) => void, + ) => void) & + (( + eventName: 'did-start-navigation', + callback: ( + 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, + 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, + 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); + } + declare class WebRequest { + onBeforeRequest: (( + filter?: ?{ + urls: Array, + }, + listener: Function, + ) => void) & + ((listener: Function) => void); + onBeforeSendHeaders: (( + filter?: ?{ + urls: Array, + }, + listener: Function, + ) => void) & + ((listener: Function) => void); + onSendHeaders: (( + filter?: ?{ + urls: Array, + }, + listener: Function, + ) => void) & + ((listener: Function) => void); + onHeadersReceived: (( + filter?: ?{ + urls: Array, + }, + listener: Function, + ) => void) & + ((listener: Function) => void); + onResponseStarted: (( + filter?: ?{ + urls: Array, + }, + listener: Function, + ) => void) & + ((listener: Function) => void); + onBeforeRedirect: (( + filter?: ?{ + urls: Array, + }, + listener: Function, + ) => void) & + ((listener: Function) => void); + onCompleted: (( + filter?: ?{ + urls: Array, + }, + listener: Function, + ) => void) & + ((listener: Function) => void); + onErrorOccurred: (( + filter?: ?{ + urls: Array, + }, + 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, + selectedColor?: ?string, + change?: ?Function, + }) => TouchBarColorPicker; + availableColors: Array; + 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, + select: Function, + highlight: Function, + selectedStyle: string, + overlayStyle: string, + showArrowButtons: boolean, + mode: string, + continuous: boolean, + }) => TouchBarScrubber; + items: Array; + 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, + selectedIndex?: ?number, + change: Function, + }) => TouchBarSegmentedControl; + segmentStyle: string; + segments: Array; + 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 TouchBarItem = any; +} diff --git a/flow-typed/npm/electron_vx.x.x.js b/flow-typed/npm/electron_vx.x.x.js deleted file mode 100644 index cbb81fb59..000000000 --- a/flow-typed/npm/electron_vx.x.x.js +++ /dev/null @@ -1,59 +0,0 @@ -// flow-typed signature: 451c88326bb7cc6aa79491d34e1c60b0 -// flow-typed version: <>/electron_v1.7.3/flow_v0.59.0 - -/** - * This is an autogenerated libdef stub for: - * - * 'electron' - * - * Fill this stub out by replacing all the `any` types. - * - * Once filled out, we encourage you to share your work with the - * community by sending a pull request to: - * https://github.com/flowtype/flow-typed - */ - -declare module 'electron' { - declare module.exports: any; -} - -/** - * We include stubs for each file inside this npm package in case you need to - * require those files directly. Feel free to delete any files that aren't - * needed. - */ -declare module 'electron/cli' { - declare module.exports: any; -} - -declare module 'electron/install' { - declare module.exports: any; -} - -declare module 'electron/test/errors' { - declare module.exports: any; -} - -declare module 'electron/test/index' { - declare module.exports: any; -} - -// Filename aliases -declare module 'electron/cli.js' { - declare module.exports: $Exports<'electron/cli'>; -} -declare module 'electron/index' { - declare module.exports: $Exports<'electron'>; -} -declare module 'electron/index.js' { - declare module.exports: $Exports<'electron'>; -} -declare module 'electron/install.js' { - declare module.exports: $Exports<'electron/install'>; -} -declare module 'electron/test/errors.js' { - declare module.exports: $Exports<'electron/test/errors'>; -} -declare module 'electron/test/index.js' { - declare module.exports: $Exports<'electron/test/index'>; -} diff --git a/src/MenuBar.js b/src/MenuBar.js index 02e654cb7..6b79c3dfa 100644 --- a/src/MenuBar.js +++ b/src/MenuBar.js @@ -97,10 +97,13 @@ export function setupMenuBar() { const menu = applicationMenu.items.find( menuItem => menuItem.label === topLevelMenu, ); - const menuItem = menu.submenu.items.find( - menuItem => menuItem.label === label, - ); - menuItems.set(action, menuItem); + if (menu) { + // $FlowFixMe submenu is missing in electron API spec + const menuItem = menu.submenu.items.find( + menuItem => menuItem.label === label, + ); + menuItems.set(action, menuItem); + } } }); diff --git a/src/chrome/AutoUpdateVersion.js b/src/chrome/AutoUpdateVersion.js index 95eb4379d..6c96260bd 100644 --- a/src/chrome/AutoUpdateVersion.js +++ b/src/chrome/AutoUpdateVersion.js @@ -38,9 +38,9 @@ export default class AutoUpdateVersion extends Component<{}, State> { componentDidMount() { if (isProduction()) { - remote.autoUpdater.setFeedURL( - `${config.updateServer}?version=${version}`, - ); + remote.autoUpdater.setFeedURL({ + url: `${config.updateServer}?version=${version}`, + }); remote.autoUpdater.on('update-downloaded', () => { this.setState({updater: 'update-downloaded'}); diff --git a/src/dispatcher/application.js b/src/dispatcher/application.js index 21ba4a56c..603a33758 100644 --- a/src/dispatcher/application.js +++ b/src/dispatcher/application.js @@ -11,16 +11,16 @@ import type Logger from '../fb-stubs/Logger.js'; export default (store: Store, logger: Logger) => { const currentWindow = remote.getCurrentWindow(); - currentWindow.on('focus', () => + currentWindow.on('focus', () => { store.dispatch({ type: 'windowIsFocused', payload: true, - }), - ); - currentWindow.on('blur', () => + }); + }); + currentWindow.on('blur', () => { store.dispatch({ type: 'windowIsFocused', payload: false, - }), - ); + }); + }); }; diff --git a/src/ui/components/Button.js b/src/ui/components/Button.js index dc6515907..5d60b2a24 100644 --- a/src/ui/components/Button.js +++ b/src/ui/components/Button.js @@ -281,7 +281,8 @@ class Button extends styled.StylableComponent< position.x = parseInt(left, 10); position.y = parseInt(bottom + 6, 10); } - menu.popup(electron.remote.getCurrentWindow(), { + menu.popup({ + window: electron.remote.getCurrentWindow(), async: true, ...position, }); diff --git a/src/ui/components/ContextMenuProvider.js b/src/ui/components/ContextMenuProvider.js index 5c3b44f88..3e3dc90d1 100644 --- a/src/ui/components/ContextMenuProvider.js +++ b/src/ui/components/ContextMenuProvider.js @@ -37,7 +37,7 @@ export default class ContextMenuProvider extends Component<{| onContextMenu = () => { const menu = electron.remote.Menu.buildFromTemplate(this._menuTemplate); this._menuTemplate = []; - menu.popup(electron.remote.getCurrentWindow(), {async: true}); + menu.popup({window: electron.remote.getCurrentWindow(), async: true}); }; render() { diff --git a/src/ui/components/searchable/FilterToken.js b/src/ui/components/searchable/FilterToken.js index b2ef03814..9d61a286c 100644 --- a/src/ui/components/searchable/FilterToken.js +++ b/src/ui/components/searchable/FilterToken.js @@ -161,7 +161,8 @@ export default class FilterToken extends PureComponent { } const menu = electron.remote.Menu.buildFromTemplate(menuTemplate); const {bottom, left} = this._ref ? this._ref.getBoundingClientRect() : {}; - menu.popup(electron.remote.getCurrentWindow(), { + menu.popup({ + window: electron.remote.getCurrentWindow(), async: true, x: parseInt(left, 10), y: parseInt(bottom, 10) + 8, diff --git a/src/utils/isProduction.js b/src/utils/isProduction.js index b873b0ce8..9816a2fb6 100644 --- a/src/utils/isProduction.js +++ b/src/utils/isProduction.js @@ -8,6 +8,7 @@ import electron from 'electron'; const _isProduction = !/node_modules[\\/]electron[\\/]/.test( + // $FlowFixMe: execPath exists, but is not in electron API spec electron.remote.process.execPath, );