From e60f2f1fa999e7490947fcd117b46458b7cad8ed Mon Sep 17 00:00:00 2001 From: Robert Jaros Date: Tue, 5 Mar 2019 00:27:28 +0100 Subject: Electron support module. --- build.gradle | 3 +- gradle.properties | 1 + kvision-modules/kvision-electron/build.gradle | 33 + .../pl/treksoft/kvision/electron/electron.kt | 5016 ++++++++++++++++++++ .../pl/treksoft/kvision/electron/nodejs/nodejs.kt | 70 + settings.gradle | 3 +- 6 files changed, 5124 insertions(+), 2 deletions(-) create mode 100644 kvision-modules/kvision-electron/build.gradle create mode 100644 kvision-modules/kvision-electron/src/main/kotlin/pl/treksoft/kvision/electron/electron.kt create mode 100644 kvision-modules/kvision-electron/src/main/kotlin/pl/treksoft/kvision/electron/nodejs/nodejs.kt diff --git a/build.gradle b/build.gradle index e77cfc3f..c2610971 100644 --- a/build.gradle +++ b/build.gradle @@ -173,7 +173,8 @@ dokka { 'kvision-modules/kvision-common-types/src/main/kotlin', 'kvision-modules/kvision-server-jooby/src/main/kotlin', 'kvision-modules/kvision-server-ktor/src/main/kotlin', - 'kvision-modules/kvision-server-spring-boot/src/main/kotlin') + 'kvision-modules/kvision-server-spring-boot/src/main/kotlin', + 'kvision-modules/kvision-electron/src/main/kotlin') classpath = [new File("dokka/kvision-dokka-helper.jar")] outputFormat = 'html' outputDirectory = "$buildDir/kdoc" diff --git a/gradle.properties b/gradle.properties index fbe47f9b..f7981e4e 100644 --- a/gradle.properties +++ b/gradle.properties @@ -19,3 +19,4 @@ jqueryKotlinVersion=0.0.4 snabbdomKotlinVersion=0.1.1 navigoKotlinVersion=0.0.3 kotlinObservableVersion=0.0.4 +nodeKtVersion=0.1.0 diff --git a/kvision-modules/kvision-electron/build.gradle b/kvision-modules/kvision-electron/build.gradle new file mode 100644 index 00000000..8716dd65 --- /dev/null +++ b/kvision-modules/kvision-electron/build.gradle @@ -0,0 +1,33 @@ +apply plugin: 'kotlin-platform-js' +apply plugin: 'kotlinx-serialization' + +task cleanLibs(type: Delete) { + delete 'build/js', 'build/libs' +} + +if (project.gradle.startParameter.taskNames.contains("jar")) { + compileKotlin2Js.dependsOn 'cleanLibs' +} + +jar { + duplicatesStrategy = DuplicatesStrategy.EXCLUDE +} + +compileKotlin2Js { + kotlinOptions.metaInfo = true + kotlinOptions.outputFile = "$project.buildDir.path/js/${project.name}.js" + kotlinOptions.sourceMap = !production + kotlinOptions.moduleKind = 'umd' +} + +compileTestKotlin2Js { + kotlinOptions.metaInfo = true + kotlinOptions.outputFile = "$project.buildDir.path/js-tests/${project.name}-tests.js" + kotlinOptions.sourceMap = !production + kotlinOptions.moduleKind = 'umd' +} + +dependencies { + compile "org.jetbrains.kotlin:kotlin-stdlib-js:$kotlinVersion" + compile "me.kgustave:node-kt:$nodeKtVersion" +} diff --git a/kvision-modules/kvision-electron/src/main/kotlin/pl/treksoft/kvision/electron/electron.kt b/kvision-modules/kvision-electron/src/main/kotlin/pl/treksoft/kvision/electron/electron.kt new file mode 100644 index 00000000..fd981333 --- /dev/null +++ b/kvision-modules/kvision-electron/src/main/kotlin/pl/treksoft/kvision/electron/electron.kt @@ -0,0 +1,5016 @@ +/* + * Copyright (c) 2017-present Robert Jaros + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +@file:Suppress( + "INTERFACE_WITH_SUPERCLASS", + "OVERRIDING_FINAL_MEMBER", + "RETURN_TYPE_MISMATCH_ON_OVERRIDE", + "CONFLICTING_OVERLOADS", + "EXTERNAL_DELEGATION", + "NESTED_CLASS_IN_EXTERNAL_INTERFACE", + "UNUSED", "PropertyName" +) +@file:JsModule("electron") +@file:JsNonModule + +package pl.treksoft.kvision.electron + +import node.ReadableStream +import node.buffer.Buffer +import org.w3c.dom.HTMLElement +import org.w3c.dom.events.EventListener +import kotlin.js.Date +import kotlin.js.Promise + +external interface EventListenerObject { + fun handleEvent(evt: Event) +} + +open external class EventEmitter { + open fun addListener(event: String, listener: Function<*>): EventEmitter /* this */ = definedExternally + open fun on(event: String, listener: Function<*>): EventEmitter /* this */ = definedExternally + open fun once(event: String, listener: Function<*>): EventEmitter /* this */ = definedExternally + open fun removeListener(event: String, listener: Function<*>): EventEmitter /* this */ = definedExternally + open fun removeAllListeners(event: String? = definedExternally /* null */): EventEmitter /* this */ = + definedExternally + + open fun setMaxListeners(n: Number): EventEmitter /* this */ = definedExternally + open fun getMaxListeners(): Number = definedExternally + open fun listeners(event: String): Array> = definedExternally + open fun emit(event: String, vararg args: Any): Boolean = definedExternally + open fun listenerCount(type: String): Number = definedExternally + open fun prependListener(event: String, listener: Function<*>): EventEmitter /* this */ = definedExternally + open fun prependOnceListener(event: String, listener: Function<*>): EventEmitter /* this */ = definedExternally + open fun eventNames(): Array = definedExternally +} + +open external class Accelerator +external interface Event { + var preventDefault: () -> Unit + var sender: WebContents + var returnValue: Any + var ctrlKey: Boolean? get() = definedExternally; set(value) = definedExternally + var metaKey: Boolean? get() = definedExternally; set(value) = definedExternally + var shiftKey: Boolean? get() = definedExternally; set(value) = definedExternally + var altKey: Boolean? get() = definedExternally; set(value) = definedExternally +} + +external interface CommonInterface { + var clipboard: Clipboard + var crashReporter: CrashReporter + var nativeImage: Any? + var screen: Screen + var shell: Shell +} + +external interface MainInterface : CommonInterface { + var app: App + var autoUpdater: AutoUpdater + var BrowserView: Any? + var BrowserWindow: Any? + var ClientRequest: Any? + var contentTracing: ContentTracing + var Cookies: Any? + var Debugger: Any? + var dialog: Dialog + var DownloadItem: Any? + var globalShortcut: GlobalShortcut + var inAppPurchase: InAppPurchase + var IncomingMessage: Any? + var ipcMain: IpcMain + var Menu: Any? + var MenuItem: Any? + var net: Net + var Notification: Any? + var powerMonitor: PowerMonitor + var powerSaveBlocker: PowerSaveBlocker + var protocol: Protocol + var session: Any? + var systemPreferences: SystemPreferences + var TouchBar: Any? + var Tray: Any? + var webContents: Any? + var WebRequest: Any? +} + +external interface RendererInterface : CommonInterface { + var BrowserWindowProxy: Any? + var desktopCapturer: DesktopCapturer + var ipcRenderer: IpcRenderer + var remote: Remote + var webFrame: WebFrame + var webviewTag: WebviewTag +} + +external interface AllElectron : MainInterface, + RendererInterface + +external var app: App = definedExternally +external var autoUpdater: AutoUpdater = definedExternally +external var clipboard: Clipboard = definedExternally +external var contentTracing: ContentTracing = definedExternally +external var crashReporter: CrashReporter = definedExternally +external var desktopCapturer: DesktopCapturer = definedExternally +external var dialog: Dialog = definedExternally +external var globalShortcut: GlobalShortcut = definedExternally +external var inAppPurchase: InAppPurchase = definedExternally +external var ipcMain: IpcMain = definedExternally +external var ipcRenderer: IpcRenderer = definedExternally +external var nativeImage: Any? = definedExternally +external var net: Net = definedExternally +external var powerMonitor: PowerMonitor = definedExternally +external var powerSaveBlocker: PowerSaveBlocker = definedExternally +external var protocol: Protocol = definedExternally +external var remote: Remote = definedExternally +external var screen: Screen = definedExternally +external var session: Any? = definedExternally +external var shell: Shell = definedExternally +external var systemPreferences: SystemPreferences = definedExternally +external var webContents: Any? = definedExternally +external var webFrame: WebFrame = definedExternally +external var webviewTag: WebviewTag = definedExternally + +external interface App : EventEmitter { + fun on( + event: String /* "accessibility-support-changed" */, + listener: (event: Event, accessibilitySupportEnabled: Boolean) -> Unit + ): App /* this */ + + fun once( + event: String /* "accessibility-support-changed" */, + listener: (event: Event, accessibilitySupportEnabled: Boolean) -> Unit + ): App /* this */ + + fun addListener( + event: String /* "accessibility-support-changed" */, + listener: (event: Event, accessibilitySupportEnabled: Boolean) -> Unit + ): App /* this */ + + fun removeListener( + event: String /* "accessibility-support-changed" */, + listener: (event: Event, accessibilitySupportEnabled: Boolean) -> Unit + ): App /* this */ + + fun on(event: String /* "activate" */, listener: (event: Event, hasVisibleWindows: Boolean) -> Unit): App /* this */ + fun once( + event: String /* "activate" */, + listener: (event: Event, hasVisibleWindows: Boolean) -> Unit + ): App /* this */ + + fun addListener( + event: String /* "activate" */, + listener: (event: Event, hasVisibleWindows: Boolean) -> Unit + ): App /* this */ + + fun removeListener( + event: String /* "activate" */, + listener: (event: Event, hasVisibleWindows: Boolean) -> Unit + ): App /* this */ + + fun on( + event: String /* "activity-was-continued" */, + listener: (event: Event, type: String, userInfo: Any) -> Unit + ): App /* this */ + + fun once( + event: String /* "activity-was-continued" */, + listener: (event: Event, type: String, userInfo: Any) -> Unit + ): App /* this */ + + fun addListener( + event: String /* "activity-was-continued" */, + listener: (event: Event, type: String, userInfo: Any) -> Unit + ): App /* this */ + + fun removeListener( + event: String /* "activity-was-continued" */, + listener: (event: Event, type: String, userInfo: Any) -> Unit + ): App /* this */ + + fun on(event: String /* "before-quit" */, listener: (event: Event) -> Unit): App /* this */ + fun once(event: String /* "before-quit" */, listener: (event: Event) -> Unit): App /* this */ + fun addListener(event: String /* "before-quit" */, listener: (event: Event) -> Unit): App /* this */ + fun removeListener(event: String /* "before-quit" */, listener: (event: Event) -> Unit): App /* this */ + fun on( + event: String /* "browser-window-blur" */, + listener: (event: Event, window: BrowserWindow) -> Unit + ): App /* this */ + + fun once( + event: String /* "browser-window-blur" */, + listener: (event: Event, window: BrowserWindow) -> Unit + ): App /* this */ + + fun addListener( + event: String /* "browser-window-blur" */, + listener: (event: Event, window: BrowserWindow) -> Unit + ): App /* this */ + + fun removeListener( + event: String /* "browser-window-blur" */, + listener: (event: Event, window: BrowserWindow) -> Unit + ): App /* this */ + + fun on( + event: String /* "browser-window-created" */, + listener: (event: Event, window: BrowserWindow) -> Unit + ): App /* this */ + + fun once( + event: String /* "browser-window-created" */, + listener: (event: Event, window: BrowserWindow) -> Unit + ): App /* this */ + + fun addListener( + event: String /* "browser-window-created" */, + listener: (event: Event, window: BrowserWindow) -> Unit + ): App /* this */ + + fun removeListener( + event: String /* "browser-window-created" */, + listener: (event: Event, window: BrowserWindow) -> Unit + ): App /* this */ + + fun on( + event: String /* "browser-window-focus" */, + listener: (event: Event, window: BrowserWindow) -> Unit + ): App /* this */ + + fun once( + event: String /* "browser-window-focus" */, + listener: (event: Event, window: BrowserWindow) -> Unit + ): App /* this */ + + fun addListener( + event: String /* "browser-window-focus" */, + listener: (event: Event, window: BrowserWindow) -> Unit + ): App /* this */ + + fun removeListener( + event: String /* "browser-window-focus" */, + listener: (event: Event, window: BrowserWindow) -> Unit + ): App /* this */ + + fun on( + event: String /* "certificate-error" */, + listener: (event: Event, webContents: WebContents, url: String, error: String, certificate: Certificate, callback: (isTrusted: Boolean) -> Unit) -> Unit + ): App /* this */ + + fun once( + event: String /* "certificate-error" */, + listener: (event: Event, webContents: WebContents, url: String, error: String, certificate: Certificate, callback: (isTrusted: Boolean) -> Unit) -> Unit + ): App /* this */ + + fun addListener( + event: String /* "certificate-error" */, + listener: (event: Event, webContents: WebContents, url: String, error: String, certificate: Certificate, callback: (isTrusted: Boolean) -> Unit) -> Unit + ): App /* this */ + + fun removeListener( + event: String /* "certificate-error" */, + listener: (event: Event, webContents: WebContents, url: String, error: String, certificate: Certificate, callback: (isTrusted: Boolean) -> Unit) -> Unit + ): App /* this */ + + fun on( + event: String /* "continue-activity" */, + listener: (event: Event, type: String, userInfo: Any) -> Unit + ): App /* this */ + + fun once( + event: String /* "continue-activity" */, + listener: (event: Event, type: String, userInfo: Any) -> Unit + ): App /* this */ + + fun addListener( + event: String /* "continue-activity" */, + listener: (event: Event, type: String, userInfo: Any) -> Unit + ): App /* this */ + + fun removeListener( + event: String /* "continue-activity" */, + listener: (event: Event, type: String, userInfo: Any) -> Unit + ): App /* this */ + + fun on( + event: String /* "continue-activity-error" */, + listener: (event: Event, type: String, error: String) -> Unit + ): App /* this */ + + fun once( + event: String /* "continue-activity-error" */, + listener: (event: Event, type: String, error: String) -> Unit + ): App /* this */ + + fun addListener( + event: String /* "continue-activity-error" */, + listener: (event: Event, type: String, error: String) -> Unit + ): App /* this */ + + fun removeListener( + event: String /* "continue-activity-error" */, + listener: (event: Event, type: String, error: String) -> Unit + ): App /* this */ + + fun on(event: String /* "gpu-process-crashed" */, listener: (event: Event, killed: Boolean) -> Unit): App /* this */ + fun once( + event: String /* "gpu-process-crashed" */, + listener: (event: Event, killed: Boolean) -> Unit + ): App /* this */ + + fun addListener( + event: String /* "gpu-process-crashed" */, + listener: (event: Event, killed: Boolean) -> Unit + ): App /* this */ + + fun removeListener( + event: String /* "gpu-process-crashed" */, + listener: (event: Event, killed: Boolean) -> Unit + ): App /* this */ + + fun on( + event: String /* "login" */, + listener: (event: Event, webContents: WebContents, request: Request, authInfo: AuthInfo, callback: (username: String, password: String) -> Unit) -> Unit + ): App /* this */ + + fun once( + event: String /* "login" */, + listener: (event: Event, webContents: WebContents, request: Request, authInfo: AuthInfo, callback: (username: String, password: String) -> Unit) -> Unit + ): App /* this */ + + fun addListener( + event: String /* "login" */, + listener: (event: Event, webContents: WebContents, request: Request, authInfo: AuthInfo, callback: (username: String, password: String) -> Unit) -> Unit + ): App /* this */ + + fun removeListener( + event: String /* "login" */, + listener: (event: Event, webContents: WebContents, request: Request, authInfo: AuthInfo, callback: (username: String, password: String) -> Unit) -> Unit + ): App /* this */ + + fun on(event: String /* "new-window-for-tab" */, listener: (event: Event) -> Unit): App /* this */ + fun once(event: String /* "new-window-for-tab" */, listener: (event: Event) -> Unit): App /* this */ + fun addListener(event: String /* "new-window-for-tab" */, listener: (event: Event) -> Unit): App /* this */ + fun removeListener(event: String /* "new-window-for-tab" */, listener: (event: Event) -> Unit): App /* this */ + fun on(event: String /* "open-file" */, listener: (event: Event, path: String) -> Unit): App /* this */ + fun once(event: String /* "open-file" */, listener: (event: Event, path: String) -> Unit): App /* this */ + fun addListener(event: String /* "open-file" */, listener: (event: Event, path: String) -> Unit): App /* this */ + fun removeListener(event: String /* "open-file" */, listener: (event: Event, path: String) -> Unit): App /* this */ + fun on(event: String /* "open-url" */, listener: (event: Event, url: String) -> Unit): App /* this */ + fun once(event: String /* "open-url" */, listener: (event: Event, url: String) -> Unit): App /* this */ + fun addListener(event: String /* "open-url" */, listener: (event: Event, url: String) -> Unit): App /* this */ + fun removeListener(event: String /* "open-url" */, listener: (event: Event, url: String) -> Unit): App /* this */ + fun on(event: String /* "quit" */, listener: (event: Event, exitCode: Number) -> Unit): App /* this */ + fun once(event: String /* "quit" */, listener: (event: Event, exitCode: Number) -> Unit): App /* this */ + fun addListener(event: String /* "quit" */, listener: (event: Event, exitCode: Number) -> Unit): App /* this */ + fun removeListener(event: String /* "quit" */, listener: (event: Event, exitCode: Number) -> Unit): App /* this */ + fun on(event: String /* "ready" */, listener: (launchInfo: Any) -> Unit): App /* this */ + fun once(event: String /* "ready" */, listener: (launchInfo: Any) -> Unit): App /* this */ + fun addListener(event: String /* "ready" */, listener: (launchInfo: Any) -> Unit): App /* this */ + fun removeListener(event: String /* "ready" */, listener: (launchInfo: Any) -> Unit): App /* this */ + fun on( + event: String /* "select-client-certificate" */, + listener: (event: Event, webContents: WebContents, url: String, certificateList: Array, callback: (certificate: Certificate? /*= null*/) -> Unit) -> Unit + ): App /* this */ + + fun once( + event: String /* "select-client-certificate" */, + listener: (event: Event, webContents: WebContents, url: String, certificateList: Array, callback: (certificate: Certificate? /*= null*/) -> Unit) -> Unit + ): App /* this */ + + fun addListener( + event: String /* "select-client-certificate" */, + listener: (event: Event, webContents: WebContents, url: String, certificateList: Array, callback: (certificate: Certificate? /*= null*/) -> Unit) -> Unit + ): App /* this */ + + fun removeListener( + event: String /* "select-client-certificate" */, + listener: (event: Event, webContents: WebContents, url: String, certificateList: Array, callback: (certificate: Certificate? /*= null*/) -> Unit) -> Unit + ): App /* this */ + + fun on( + event: String /* "update-activity-state" */, + listener: (event: Event, type: String, userInfo: Any) -> Unit + ): App /* this */ + + fun once( + event: String /* "update-activity-state" */, + listener: (event: Event, type: String, userInfo: Any) -> Unit + ): App /* this */ + + fun addListener( + event: String /* "update-activity-state" */, + listener: (event: Event, type: String, userInfo: Any) -> Unit + ): App /* this */ + + fun removeListener( + event: String /* "update-activity-state" */, + listener: (event: Event, type: String, userInfo: Any) -> Unit + ): App /* this */ + + fun on( + event: String /* "web-contents-created" */, + listener: (event: Event, webContents: WebContents) -> Unit + ): App /* this */ + + fun once( + event: String /* "web-contents-created" */, + listener: (event: Event, webContents: WebContents) -> Unit + ): App /* this */ + + fun addListener( + event: String /* "web-contents-created" */, + listener: (event: Event, webContents: WebContents) -> Unit + ): App /* this */ + + fun removeListener( + event: String /* "web-contents-created" */, + listener: (event: Event, webContents: WebContents) -> Unit + ): App /* this */ + + fun on(event: String /* "will-continue-activity" */, listener: (event: Event, type: String) -> Unit): App /* this */ + fun once( + event: String /* "will-continue-activity" */, + listener: (event: Event, type: String) -> Unit + ): App /* this */ + + fun addListener( + event: String /* "will-continue-activity" */, + listener: (event: Event, type: String) -> Unit + ): App /* this */ + + fun removeListener( + event: String /* "will-continue-activity" */, + listener: (event: Event, type: String) -> Unit + ): App /* this */ + + override fun on(event: String /* "will-finish-launching" */, listener: Function<*>): App /* this */ + override fun once(event: String /* "will-finish-launching" */, listener: Function<*>): App /* this */ + override fun addListener(event: String /* "will-finish-launching" */, listener: Function<*>): App /* this */ + override fun removeListener(event: String /* "will-finish-launching" */, listener: Function<*>): App /* this */ + fun on(event: String /* "will-quit" */, listener: (event: Event) -> Unit): App /* this */ + fun once(event: String /* "will-quit" */, listener: (event: Event) -> Unit): App /* this */ + fun addListener(event: String /* "will-quit" */, listener: (event: Event) -> Unit): App /* this */ + fun removeListener(event: String /* "will-quit" */, listener: (event: Event) -> Unit): App /* this */ + override fun on(event: String /* "window-all-closed" */, listener: Function<*>): App /* this */ + override fun once(event: String /* "window-all-closed" */, listener: Function<*>): App /* this */ + override fun addListener(event: String /* "window-all-closed" */, listener: Function<*>): App /* this */ + override fun removeListener(event: String /* "window-all-closed" */, listener: Function<*>): App /* this */ + fun addRecentDocument(path: String) + fun clearRecentDocuments() + fun disableDomainBlockingFor3DAPIs() + fun disableHardwareAcceleration() + fun enableMixedSandbox() + fun exit(exitCode: Number? = definedExternally /* null */) + fun focus() + fun getAppMetrics(): Array + fun getAppPath(): String + fun getBadgeCount(): Number + fun getCurrentActivityType(): String + fun getFileIcon(path: String, callback: (error: Error, icon: NativeImage) -> Unit) + fun getFileIcon(path: String, options: FileIconOptions, callback: (error: Error, icon: NativeImage) -> Unit) + fun getGPUFeatureStatus(): GPUFeatureStatus + fun getJumpListSettings(): JumpListSettings + fun getLocale(): String + fun getLoginItemSettings(options: LoginItemSettingsOptions? = definedExternally /* null */): LoginItemSettings + fun getName(): String + fun getPath(name: String): String + fun getVersion(): String + fun hide() + fun importCertificate(options: ImportCertificateOptions, callback: (result: Number) -> Unit) + fun invalidateCurrentActivity(type: String) + fun isAccessibilitySupportEnabled(): Boolean + fun isDefaultProtocolClient( + protocol: String, + path: String? = definedExternally /* null */, + args: Array? = definedExternally /* null */ + ): Boolean + + fun isInApplicationsFolder(): Boolean + fun isReady(): Boolean + fun isUnityRunning(): Boolean + fun makeSingleInstance(callback: (argv: Array, workingDirectory: String) -> Unit): Boolean + fun moveToApplicationsFolder(): Boolean + fun quit() + fun relaunch(options: RelaunchOptions? = definedExternally /* null */) + fun releaseSingleInstance() + fun removeAsDefaultProtocolClient( + protocol: String, + path: String? = definedExternally /* null */, + args: Array? = definedExternally /* null */ + ): Boolean + + fun setAboutPanelOptions(options: AboutPanelOptionsOptions) + fun setAccessibilitySupportEnabled(enabled: Boolean) + fun setAppUserModelId(id: String) + fun setAsDefaultProtocolClient( + protocol: String, + path: String? = definedExternally /* null */, + args: Array? = definedExternally /* null */ + ): Boolean + + fun setBadgeCount(count: Number): Boolean + fun setJumpList(categories: Array) + fun setLoginItemSettings(settings: Settings) + fun setName(name: String) + fun setPath(name: String, path: String) + fun setUserActivity(type: String, userInfo: Any, webpageURL: String? = definedExternally /* null */) + fun setUserTasks(tasks: Array): Boolean + fun show() + fun startAccessingSecurityScopedResource(bookmarkData: String): Function<*> + fun updateCurrentActivity(type: String, userInfo: Any) + var commandLine: CommandLine + var dock: Dock +} + +external interface AutoUpdater : EventEmitter { + override fun on(event: String /* "checking-for-update" */, listener: Function<*>): AutoUpdater /* this */ + override fun once(event: String /* "checking-for-update" */, listener: Function<*>): AutoUpdater /* this */ + override fun addListener(event: String /* "checking-for-update" */, listener: Function<*>): AutoUpdater /* this */ + override fun removeListener( + event: String /* "checking-for-update" */, + listener: Function<*> + ): AutoUpdater /* this */ + + fun on(event: String /* "error" */, listener: (error: Error) -> Unit): AutoUpdater /* this */ + fun once(event: String /* "error" */, listener: (error: Error) -> Unit): AutoUpdater /* this */ + fun addListener(event: String /* "error" */, listener: (error: Error) -> Unit): AutoUpdater /* this */ + fun removeListener(event: String /* "error" */, listener: (error: Error) -> Unit): AutoUpdater /* this */ + override fun on(event: String /* "update-available" */, listener: Function<*>): AutoUpdater /* this */ + override fun once(event: String /* "update-available" */, listener: Function<*>): AutoUpdater /* this */ + override fun addListener(event: String /* "update-available" */, listener: Function<*>): AutoUpdater /* this */ + override fun removeListener(event: String /* "update-available" */, listener: Function<*>): AutoUpdater /* this */ + fun on( + event: String /* "update-downloaded" */, + listener: (event: Event, releaseNotes: String, releaseName: String, releaseDate: Date, updateURL: String) -> Unit + ): AutoUpdater /* this */ + + fun once( + event: String /* "update-downloaded" */, + listener: (event: Event, releaseNotes: String, releaseName: String, releaseDate: Date, updateURL: String) -> Unit + ): AutoUpdater /* this */ + + fun addListener( + event: String /* "update-downloaded" */, + listener: (event: Event, releaseNotes: String, releaseName: String, releaseDate: Date, updateURL: String) -> Unit + ): AutoUpdater /* this */ + + fun removeListener( + event: String /* "update-downloaded" */, + listener: (event: Event, releaseNotes: String, releaseName: String, releaseDate: Date, updateURL: String) -> Unit + ): AutoUpdater /* this */ + + override fun on(event: String /* "update-not-available" */, listener: Function<*>): AutoUpdater /* this */ + override fun once(event: String /* "update-not-available" */, listener: Function<*>): AutoUpdater /* this */ + override fun addListener(event: String /* "update-not-available" */, listener: Function<*>): AutoUpdater /* this */ + override fun removeListener( + event: String /* "update-not-available" */, + listener: Function<*> + ): AutoUpdater /* this */ + + fun checkForUpdates() + fun getFeedURL(): String + fun quitAndInstall() + fun setFeedURL(options: FeedURLOptions) +} + +external interface BluetoothDevice { + var deviceId: String + var deviceName: String +} + +open external class BrowserView(options: BrowserViewConstructorOptions? = definedExternally /* null */) : + EventEmitter { + open fun destroy(): Unit = definedExternally + open fun isDestroyed(): Boolean = definedExternally + open fun setAutoResize(options: AutoResizeOptions): Unit = definedExternally + open fun setBackgroundColor(color: String): Unit = definedExternally + open fun setBounds(bounds: Rectangle): Unit = definedExternally + open var id: Number = definedExternally + open var webContents: WebContents = definedExternally + + companion object { + fun fromId(id: Number): BrowserView = definedExternally + fun fromWebContents(webContents: WebContents): BrowserView? = definedExternally + fun getAllViews(): Array = definedExternally + } +} + +open external class BrowserWindow(options: BrowserWindowConstructorOptions? = definedExternally /* null */) : + EventEmitter { + open fun on( + event: String /* "app-command" */, + listener: (event: Event, command: String) -> Unit + ): BrowserWindow /* this */ = definedExternally + + open fun once( + event: String /* "app-command" */, + listener: (event: Event, command: String) -> Unit + ): BrowserWindow /* this */ = definedExternally + + open fun addListener( + event: String /* "app-command" */, + listener: (event: Event, command: String) -> Unit + ): BrowserWindow /* this */ = definedExternally + + open fun removeListener( + event: String /* "app-command" */, + listener: (event: Event, command: String) -> Unit + ): BrowserWindow /* this */ = definedExternally + + override fun on(event: String /* "blur" */, listener: Function<*>): BrowserWindow /* this */ = definedExternally + override fun once(event: String /* "blur" */, listener: Function<*>): BrowserWindow /* this */ = definedExternally + override fun addListener(event: String /* "blur" */, listener: Function<*>): BrowserWindow /* this */ = + definedExternally + + override fun removeListener(event: String /* "blur" */, listener: Function<*>): BrowserWindow /* this */ = + definedExternally + + open fun on(event: String /* "close" */, listener: (event: Event) -> Unit): BrowserWindow /* this */ = + definedExternally + + open fun once(event: String /* "close" */, listener: (event: Event) -> Unit): BrowserWindow /* this */ = + definedExternally + + open fun addListener(event: String /* "close" */, listener: (event: Event) -> Unit): BrowserWindow /* this */ = + definedExternally + + open fun removeListener(event: String /* "close" */, listener: (event: Event) -> Unit): BrowserWindow /* this */ = + definedExternally + + override fun on(event: String /* "closed" */, listener: Function<*>): BrowserWindow /* this */ = definedExternally + override fun once(event: String /* "closed" */, listener: Function<*>): BrowserWindow /* this */ = definedExternally + override fun addListener(event: String /* "closed" */, listener: Function<*>): BrowserWindow /* this */ = + definedExternally + + override fun removeListener(event: String /* "closed" */, listener: Function<*>): BrowserWindow /* this */ = + definedExternally + + override fun on(event: String /* "enter-full-screen" */, listener: Function<*>): BrowserWindow /* this */ = + definedExternally + + override fun once(event: String /* "enter-full-screen" */, listener: Function<*>): BrowserWindow /* this */ = + definedExternally + + override fun addListener(event: String /* "enter-full-screen" */, listener: Function<*>): BrowserWindow /* this */ = + definedExternally + + override fun removeListener( + event: String /* "enter-full-screen" */, + listener: Function<*> + ): BrowserWindow /* this */ = definedExternally + + override fun on(event: String /* "enter-html-full-screen" */, listener: Function<*>): BrowserWindow /* this */ = + definedExternally + + override fun once(event: String /* "enter-html-full-screen" */, listener: Function<*>): BrowserWindow /* this */ = + definedExternally + + override fun addListener( + event: String /* "enter-html-full-screen" */, + listener: Function<*> + ): BrowserWindow /* this */ = definedExternally + + override fun removeListener( + event: String /* "enter-html-full-screen" */, + listener: Function<*> + ): BrowserWindow /* this */ = definedExternally + + override fun on(event: String /* "focus" */, listener: Function<*>): BrowserWindow /* this */ = definedExternally + override fun once(event: String /* "focus" */, listener: Function<*>): BrowserWindow /* this */ = definedExternally + override fun addListener(event: String /* "focus" */, listener: Function<*>): BrowserWindow /* this */ = + definedExternally + + override fun removeListener(event: String /* "focus" */, listener: Function<*>): BrowserWindow /* this */ = + definedExternally + + override fun on(event: String /* "hide" */, listener: Function<*>): BrowserWindow /* this */ = definedExternally + override fun once(event: String /* "hide" */, listener: Function<*>): BrowserWindow /* this */ = definedExternally + override fun addListener(event: String /* "hide" */, listener: Function<*>): BrowserWindow /* this */ = + definedExternally + + override fun removeListener(event: String /* "hide" */, listener: Function<*>): BrowserWindow /* this */ = + definedExternally + + override fun on(event: String /* "leave-full-screen" */, listener: Function<*>): BrowserWindow /* this */ = + definedExternally + + override fun once(event: String /* "leave-full-screen" */, listener: Function<*>): BrowserWindow /* this */ = + definedExternally + + override fun addListener(event: String /* "leave-full-screen" */, listener: Function<*>): BrowserWindow /* this */ = + definedExternally + + override fun removeListener( + event: String /* "leave-full-screen" */, + listener: Function<*> + ): BrowserWindow /* this */ = definedExternally + + override fun on(event: String /* "leave-html-full-screen" */, listener: Function<*>): BrowserWindow /* this */ = + definedExternally + + override fun once(event: String /* "leave-html-full-screen" */, listener: Function<*>): BrowserWindow /* this */ = + definedExternally + + override fun addListener( + event: String /* "leave-html-full-screen" */, + listener: Function<*> + ): BrowserWindow /* this */ = definedExternally + + override fun removeListener( + event: String /* "leave-html-full-screen" */, + listener: Function<*> + ): BrowserWindow /* this */ = definedExternally + + override fun on(event: String /* "maximize" */, listener: Function<*>): BrowserWindow /* this */ = definedExternally + override fun once(event: String /* "maximize" */, listener: Function<*>): BrowserWindow /* this */ = + definedExternally + + override fun addListener(event: String /* "maximize" */, listener: Function<*>): BrowserWindow /* this */ = + definedExternally + + override fun removeListener(event: String /* "maximize" */, listener: Function<*>): BrowserWindow /* this */ = + definedExternally + + override fun on(event: String /* "minimize" */, listener: Function<*>): BrowserWindow /* this */ = definedExternally + override fun once(event: String /* "minimize" */, listener: Function<*>): BrowserWindow /* this */ = + definedExternally + + override fun addListener(event: String /* "minimize" */, listener: Function<*>): BrowserWindow /* this */ = + definedExternally + + override fun removeListener(event: String /* "minimize" */, listener: Function<*>): BrowserWindow /* this */ = + definedExternally + + override fun on(event: String /* "move" */, listener: Function<*>): BrowserWindow /* this */ = definedExternally + override fun once(event: String /* "move" */, listener: Function<*>): BrowserWindow /* this */ = definedExternally + override fun addListener(event: String /* "move" */, listener: Function<*>): BrowserWindow /* this */ = + definedExternally + + override fun removeListener(event: String /* "move" */, listener: Function<*>): BrowserWindow /* this */ = + definedExternally + + override fun on(event: String /* "moved" */, listener: Function<*>): BrowserWindow /* this */ = definedExternally + override fun once(event: String /* "moved" */, listener: Function<*>): BrowserWindow /* this */ = definedExternally + override fun addListener(event: String /* "moved" */, listener: Function<*>): BrowserWindow /* this */ = + definedExternally + + override fun removeListener(event: String /* "moved" */, listener: Function<*>): BrowserWindow /* this */ = + definedExternally + + override fun on(event: String /* "new-window-for-tab" */, listener: Function<*>): BrowserWindow /* this */ = + definedExternally + + override fun once(event: String /* "new-window-for-tab" */, listener: Function<*>): BrowserWindow /* this */ = + definedExternally + + override fun addListener( + event: String /* "new-window-for-tab" */, + listener: Function<*> + ): BrowserWindow /* this */ = definedExternally + + override fun removeListener( + event: String /* "new-window-for-tab" */, + listener: Function<*> + ): BrowserWindow /* this */ = definedExternally + + open fun on( + event: String /* "page-title-updated" */, + listener: (event: Event, title: String) -> Unit + ): BrowserWindow /* this */ = definedExternally + + open fun once( + event: String /* "page-title-updated" */, + listener: (event: Event, title: String) -> Unit + ): BrowserWindow /* this */ = definedExternally + + open fun addListener( + event: String /* "page-title-updated" */, + listener: (event: Event, title: String) -> Unit + ): BrowserWindow /* this */ = definedExternally + + open fun removeListener( + event: String /* "page-title-updated" */, + listener: (event: Event, title: String) -> Unit + ): BrowserWindow /* this */ = definedExternally + + override fun on(event: String /* "ready-to-show" */, listener: Function<*>): BrowserWindow /* this */ = + definedExternally + + override fun once(event: String /* "ready-to-show" */, listener: Function<*>): BrowserWindow /* this */ = + definedExternally + + override fun addListener(event: String /* "ready-to-show" */, listener: Function<*>): BrowserWindow /* this */ = + definedExternally + + override fun removeListener(event: String /* "ready-to-show" */, listener: Function<*>): BrowserWindow /* this */ = + definedExternally + + override fun on(event: String /* "resize" */, listener: Function<*>): BrowserWindow /* this */ = definedExternally + override fun once(event: String /* "resize" */, listener: Function<*>): BrowserWindow /* this */ = definedExternally + override fun addListener(event: String /* "resize" */, listener: Function<*>): BrowserWindow /* this */ = + definedExternally + + override fun removeListener(event: String /* "resize" */, listener: Function<*>): BrowserWindow /* this */ = + definedExternally + + override fun on(event: String /* "responsive" */, listener: Function<*>): BrowserWindow /* this */ = + definedExternally + + override fun once(event: String /* "responsive" */, listener: Function<*>): BrowserWindow /* this */ = + definedExternally + + override fun addListener(event: String /* "responsive" */, listener: Function<*>): BrowserWindow /* this */ = + definedExternally + + override fun removeListener(event: String /* "responsive" */, listener: Function<*>): BrowserWindow /* this */ = + definedExternally + + override fun on(event: String /* "restore" */, listener: Function<*>): BrowserWindow /* this */ = definedExternally + override fun once(event: String /* "restore" */, listener: Function<*>): BrowserWindow /* this */ = + definedExternally + + override fun addListener(event: String /* "restore" */, listener: Function<*>): BrowserWindow /* this */ = + definedExternally + + override fun removeListener(event: String /* "restore" */, listener: Function<*>): BrowserWindow /* this */ = + definedExternally + + override fun on(event: String /* "scroll-touch-begin" */, listener: Function<*>): BrowserWindow /* this */ = + definedExternally + + override fun once(event: String /* "scroll-touch-begin" */, listener: Function<*>): BrowserWindow /* this */ = + definedExternally + + override fun addListener( + event: String /* "scroll-touch-begin" */, + listener: Function<*> + ): BrowserWindow /* this */ = definedExternally + + override fun removeListener( + event: String /* "scroll-touch-begin" */, + listener: Function<*> + ): BrowserWindow /* this */ = definedExternally + + override fun on(event: String /* "scroll-touch-edge" */, listener: Function<*>): BrowserWindow /* this */ = + definedExternally + + override fun once(event: String /* "scroll-touch-edge" */, listener: Function<*>): BrowserWindow /* this */ = + definedExternally + + override fun addListener(event: String /* "scroll-touch-edge" */, listener: Function<*>): BrowserWindow /* this */ = + definedExternally + + override fun removeListener( + event: String /* "scroll-touch-edge" */, + listener: Function<*> + ): BrowserWindow /* this */ = definedExternally + + override fun on(event: String /* "scroll-touch-end" */, listener: Function<*>): BrowserWindow /* this */ = + definedExternally + + override fun once(event: String /* "scroll-touch-end" */, listener: Function<*>): BrowserWindow /* this */ = + definedExternally + + override fun addListener(event: String /* "scroll-touch-end" */, listener: Function<*>): BrowserWindow /* this */ = + definedExternally + + override fun removeListener( + event: String /* "scroll-touch-end" */, + listener: Function<*> + ): BrowserWindow /* this */ = definedExternally + + override fun on(event: String /* "session-end" */, listener: Function<*>): BrowserWindow /* this */ = + definedExternally + + override fun once(event: String /* "session-end" */, listener: Function<*>): BrowserWindow /* this */ = + definedExternally + + override fun addListener(event: String /* "session-end" */, listener: Function<*>): BrowserWindow /* this */ = + definedExternally + + override fun removeListener(event: String /* "session-end" */, listener: Function<*>): BrowserWindow /* this */ = + definedExternally + + override fun on(event: String /* "sheet-begin" */, listener: Function<*>): BrowserWindow /* this */ = + definedExternally + + override fun once(event: String /* "sheet-begin" */, listener: Function<*>): BrowserWindow /* this */ = + definedExternally + + override fun addListener(event: String /* "sheet-begin" */, listener: Function<*>): BrowserWindow /* this */ = + definedExternally + + override fun removeListener(event: String /* "sheet-begin" */, listener: Function<*>): BrowserWindow /* this */ = + definedExternally + + override fun on(event: String /* "sheet-end" */, listener: Function<*>): BrowserWindow /* this */ = + definedExternally + + override fun once(event: String /* "sheet-end" */, listener: Function<*>): BrowserWindow /* this */ = + definedExternally + + override fun addListener(event: String /* "sheet-end" */, listener: Function<*>): BrowserWindow /* this */ = + definedExternally + + override fun removeListener(event: String /* "sheet-end" */, listener: Function<*>): BrowserWindow /* this */ = + definedExternally + + override fun on(event: String /* "show" */, listener: Function<*>): BrowserWindow /* this */ = definedExternally + override fun once(event: String /* "show" */, listener: Function<*>): BrowserWindow /* this */ = definedExternally + override fun addListener(event: String /* "show" */, listener: Function<*>): BrowserWindow /* this */ = + definedExternally + + override fun removeListener(event: String /* "show" */, listener: Function<*>): BrowserWindow /* this */ = + definedExternally + + open fun on( + event: String /* "swipe" */, + listener: (event: Event, direction: String) -> Unit + ): BrowserWindow /* this */ = definedExternally + + open fun once( + event: String /* "swipe" */, + listener: (event: Event, direction: String) -> Unit + ): BrowserWindow /* this */ = definedExternally + + open fun addListener( + event: String /* "swipe" */, + listener: (event: Event, direction: String) -> Unit + ): BrowserWindow /* this */ = definedExternally + + open fun removeListener( + event: String /* "swipe" */, + listener: (event: Event, direction: String) -> Unit + ): BrowserWindow /* this */ = definedExternally + + override fun on(event: String /* "unmaximize" */, listener: Function<*>): BrowserWindow /* this */ = + definedExternally + + override fun once(event: String /* "unmaximize" */, listener: Function<*>): BrowserWindow /* this */ = + definedExternally + + override fun addListener(event: String /* "unmaximize" */, listener: Function<*>): BrowserWindow /* this */ = + definedExternally + + override fun removeListener(event: String /* "unmaximize" */, listener: Function<*>): BrowserWindow /* this */ = + definedExternally + + override fun on(event: String /* "unresponsive" */, listener: Function<*>): BrowserWindow /* this */ = + definedExternally + + override fun once(event: String /* "unresponsive" */, listener: Function<*>): BrowserWindow /* this */ = + definedExternally + + override fun addListener(event: String /* "unresponsive" */, listener: Function<*>): BrowserWindow /* this */ = + definedExternally + + override fun removeListener(event: String /* "unresponsive" */, listener: Function<*>): BrowserWindow /* this */ = + definedExternally + + open fun addTabbedWindow(browserWindow: BrowserWindow): Unit = definedExternally + open fun blur(): Unit = definedExternally + open fun blurWebView(): Unit = definedExternally + open fun capturePage(callback: (image: NativeImage) -> Unit): Unit = definedExternally + open fun capturePage(rect: Rectangle, callback: (image: NativeImage) -> Unit): Unit = definedExternally + open fun center(): Unit = definedExternally + open fun close(): Unit = definedExternally + open fun closeFilePreview(): Unit = definedExternally + open fun destroy(): Unit = definedExternally + open fun flashFrame(flag: Boolean): Unit = definedExternally + open fun focus(): Unit = definedExternally + open fun focusOnWebView(): Unit = definedExternally + open fun getBounds(): Rectangle = definedExternally + open fun getBrowserView(): BrowserView? = definedExternally + open fun getChildWindows(): Array = definedExternally + open fun getContentBounds(): Rectangle = definedExternally + open fun getContentSize(): Array = definedExternally + open fun getMaximumSize(): Array = definedExternally + open fun getMinimumSize(): Array = definedExternally + open fun getNativeWindowHandle(): Buffer = definedExternally + open fun getOpacity(): Number = definedExternally + open fun getParentWindow(): BrowserWindow = definedExternally + open fun getPosition(): Array = definedExternally + open fun getRepresentedFilename(): String = definedExternally + open fun getSize(): Array = definedExternally + open fun getTitle(): String = definedExternally + open fun hasShadow(): Boolean = definedExternally + open fun hide(): Unit = definedExternally + open fun hookWindowMessage(message: Number, callback: Function<*>): Unit = definedExternally + open fun isAlwaysOnTop(): Boolean = definedExternally + open fun isClosable(): Boolean = definedExternally + open fun isDestroyed(): Boolean = definedExternally + open fun isDocumentEdited(): Boolean = definedExternally + open fun isFocused(): Boolean = definedExternally + open fun isFullScreen(): Boolean = definedExternally + open fun isFullScreenable(): Boolean = definedExternally + open fun isKiosk(): Boolean = definedExternally + open fun isMaximizable(): Boolean = definedExternally + open fun isMaximized(): Boolean = definedExternally + open fun isMenuBarAutoHide(): Boolean = definedExternally + open fun isMenuBarVisible(): Boolean = definedExternally + open fun isMinimizable(): Boolean = definedExternally + open fun isMinimized(): Boolean = definedExternally + open fun isModal(): Boolean = definedExternally + open fun isMovable(): Boolean = definedExternally + open fun isResizable(): Boolean = definedExternally + open fun isSimpleFullScreen(): Boolean = definedExternally + open fun isVisible(): Boolean = definedExternally + open fun isVisibleOnAllWorkspaces(): Boolean = definedExternally + open fun isWindowMessageHooked(message: Number): Boolean = definedExternally + open fun loadFile(filePath: String): Unit = definedExternally + open fun loadURL(url: String, options: LoadURLOptions? = definedExternally /* null */): Unit = definedExternally + open fun maximize(): Unit = definedExternally + open fun mergeAllWindows(): Unit = definedExternally + open fun minimize(): Unit = definedExternally + open fun moveTabToNewWindow(): Unit = definedExternally + open fun previewFile(path: String, displayName: String? = definedExternally /* null */): Unit = definedExternally + open fun reload(): Unit = definedExternally + open fun restore(): Unit = definedExternally + open fun selectNextTab(): Unit = definedExternally + open fun selectPreviousTab(): Unit = definedExternally + open fun setAlwaysOnTop( + flag: Boolean, + level: String? /* "normal" */ = definedExternally /* null */, + relativeLevel: Number? = definedExternally /* null */ + ): Unit = definedExternally + + open fun setAlwaysOnTop( + flag: Boolean, + level: String? /* "floating" */ = definedExternally /* null */, + relativeLevel: Number? = definedExternally /* null */ + ): Unit = definedExternally + + open fun setAlwaysOnTop( + flag: Boolean, + level: String? /* "torn-off-menu" */ = definedExternally /* null */, + relativeLevel: Number? = definedExternally /* null */ + ): Unit = definedExternally + + open fun setAlwaysOnTop( + flag: Boolean, + level: String? /* "modal-panel" */ = definedExternally /* null */, + relativeLevel: Number? = definedExternally /* null */ + ): Unit = definedExternally + + open fun setAlwaysOnTop( + flag: Boolean, + level: String? /* "main-menu" */ = definedExternally /* null */, + relativeLevel: Number? = definedExternally /* null */ + ): Unit = definedExternally + + open fun setAlwaysOnTop( + flag: Boolean, + level: String? /* "status" */ = definedExternally /* null */, + relativeLevel: Number? = definedExternally /* null */ + ): Unit = definedExternally + + open fun setAlwaysOnTop( + flag: Boolean, + level: String? /* "pop-up-menu" */ = definedExternally /* null */, + relativeLevel: Number? = definedExternally /* null */ + ): Unit = definedExternally + + open fun setAlwaysOnTop( + flag: Boolean, + level: String? /* "screen-saver" */ = definedExternally /* null */, + relativeLevel: Number? = definedExternally /* null */ + ): Unit = definedExternally + + open fun setAppDetails(options: AppDetailsOptions): Unit = definedExternally + open fun setAspectRatio(aspectRatio: Number, extraSize: Size): Unit = definedExternally + open fun setAutoHideCursor(autoHide: Boolean): Unit = definedExternally + open fun setAutoHideMenuBar(hide: Boolean): Unit = definedExternally + open fun setBounds(bounds: Rectangle, animate: Boolean? = definedExternally /* null */): Unit = definedExternally + open fun setBrowserView(browserView: BrowserView): Unit = definedExternally + open fun setClosable(closable: Boolean): Unit = definedExternally + open fun setContentBounds(bounds: Rectangle, animate: Boolean? = definedExternally /* null */): Unit = + definedExternally + + open fun setContentProtection(enable: Boolean): Unit = definedExternally + open fun setContentSize(width: Number, height: Number, animate: Boolean? = definedExternally /* null */): Unit = + definedExternally + + open fun setDocumentEdited(edited: Boolean): Unit = definedExternally + open fun setEnabled(enable: Boolean): Unit = definedExternally + open fun setFocusable(focusable: Boolean): Unit = definedExternally + open fun setFullScreen(flag: Boolean): Unit = definedExternally + open fun setFullScreenable(fullscreenable: Boolean): Unit = definedExternally + open fun setHasShadow(hasShadow: Boolean): Unit = definedExternally + open fun setIcon(icon: NativeImage): Unit = definedExternally + open fun setIgnoreMouseEvents( + ignore: Boolean, + options: IgnoreMouseEventsOptions? = definedExternally /* null */ + ): Unit = definedExternally + + open fun setKiosk(flag: Boolean): Unit = definedExternally + open fun setMaximizable(maximizable: Boolean): Unit = definedExternally + open fun setMaximumSize(width: Number, height: Number): Unit = definedExternally + open fun setMenu(menu: Menu?): Unit = definedExternally + open fun setMenuBarVisibility(visible: Boolean): Unit = definedExternally + open fun setMinimizable(minimizable: Boolean): Unit = definedExternally + open fun setMinimumSize(width: Number, height: Number): Unit = definedExternally + open fun setMovable(movable: Boolean): Unit = definedExternally + open fun setOpacity(opacity: Number): Unit = definedExternally + open fun setOverlayIcon(overlay: NativeImage, description: String): Unit = definedExternally + open fun setParentWindow(parent: BrowserWindow): Unit = definedExternally + open fun setPosition(x: Number, y: Number, animate: Boolean? = definedExternally /* null */): Unit = + definedExternally + + open fun setProgressBar(progress: Number, options: ProgressBarOptions? = definedExternally /* null */): Unit = + definedExternally + + open fun setRepresentedFilename(filename: String): Unit = definedExternally + open fun setResizable(resizable: Boolean): Unit = definedExternally + open fun setSheetOffset(offsetY: Number, offsetX: Number? = definedExternally /* null */): Unit = definedExternally + open fun setSimpleFullScreen(flag: Boolean): Unit = definedExternally + open fun setSize(width: Number, height: Number, animate: Boolean? = definedExternally /* null */): Unit = + definedExternally + + open fun setSkipTaskbar(skip: Boolean): Unit = definedExternally + open fun setThumbarButtons(buttons: Array): Boolean = definedExternally + open fun setThumbnailClip(region: Rectangle): Unit = definedExternally + open fun setThumbnailToolTip(toolTip: String): Unit = definedExternally + open fun setTitle(title: String): Unit = definedExternally + open fun setTouchBar(touchBar: TouchBar): Unit = definedExternally + open fun setVibrancy(type: String /* "appearance-based" */): Unit = definedExternally + open fun setVibrancy(type: String /* "light" */): Unit = definedExternally + open fun setVibrancy(type: String /* "dark" */): Unit = definedExternally + open fun setVibrancy(type: String /* "titlebar" */): Unit = definedExternally + open fun setVibrancy(type: String /* "selection" */): Unit = definedExternally + open fun setVibrancy(type: String /* "menu" */): Unit = definedExternally + open fun setVibrancy(type: String /* "popover" */): Unit = definedExternally + open fun setVibrancy(type: String /* "sidebar" */): Unit = definedExternally + open fun setVibrancy(type: String /* "medium-light" */): Unit = definedExternally + open fun setVibrancy(type: String /* "ultra-dark" */): Unit = definedExternally + open fun setVisibleOnAllWorkspaces(visible: Boolean): Unit = definedExternally + open fun show(): Unit = definedExternally + open fun showDefinitionForSelection(): Unit = definedExternally + open fun showInactive(): Unit = definedExternally + open fun toggleTabBar(): Unit = definedExternally + open fun unhookAllWindowMessages(): Unit = definedExternally + open fun unhookWindowMessage(message: Number): Unit = definedExternally + open fun unmaximize(): Unit = definedExternally + open var id: Number = definedExternally + open var webContents: WebContents = definedExternally + + companion object { + fun addDevToolsExtension(path: String): Unit = definedExternally + fun addExtension(path: String): Unit = definedExternally + fun fromBrowserView(browserView: BrowserView): BrowserWindow? = definedExternally + fun fromId(id: Number): BrowserWindow = definedExternally + fun fromWebContents(webContents: WebContents): BrowserWindow = definedExternally + fun getAllWindows(): Array = definedExternally + fun getDevToolsExtensions(): DevToolsExtensions = definedExternally + fun getExtensions(): Extensions = definedExternally + fun getFocusedWindow(): BrowserWindow = definedExternally + fun removeDevToolsExtension(name: String): Unit = definedExternally + fun removeExtension(name: String): Unit = definedExternally + } + + open fun setAlwaysOnTop(flag: Boolean): Unit = definedExternally +} + +open external class BrowserWindowProxy : EventEmitter { + open fun blur(): Unit = definedExternally + open fun close(): Unit = definedExternally + open fun eval(code: String): Unit = definedExternally + open fun focus(): Unit = definedExternally + open fun postMessage(message: String, targetOrigin: String): Unit = definedExternally + open fun print(): Unit = definedExternally + open var closed: Boolean = definedExternally +} + +external interface Certificate { + var data: String + var fingerprint: String + var issuer: CertificatePrincipal + var issuerCert: Certificate + var issuerName: String + var serialNumber: String + var subject: CertificatePrincipal + var subjectName: String + var validExpiry: Number + var validStart: Number +} + +external interface CertificatePrincipal { + var commonName: String + var country: String + var locality: String + var organizations: Array + var organizationUnits: Array + var state: String +} + +open external class ClientRequest : EventEmitter { + constructor(options: String /* "redirect" */) + constructor(options: String /* "method" */) + constructor(options: String /* "url" */) + constructor(options: String /* "session" */) + constructor(options: String /* "partition" */) + constructor(options: String /* "protocol" */) + constructor(options: String /* "host" */) + constructor(options: String /* "hostname" */) + constructor(options: String /* "port" */) + constructor(options: String /* "path" */) + + override fun on(event: String /* "abort" */, listener: Function<*>): ClientRequest /* this */ = definedExternally + override fun once(event: String /* "abort" */, listener: Function<*>): ClientRequest /* this */ = definedExternally + override fun addListener(event: String /* "abort" */, listener: Function<*>): ClientRequest /* this */ = + definedExternally + + override fun removeListener(event: String /* "abort" */, listener: Function<*>): ClientRequest /* this */ = + definedExternally + + override fun on(event: String /* "close" */, listener: Function<*>): ClientRequest /* this */ = definedExternally + override fun once(event: String /* "close" */, listener: Function<*>): ClientRequest /* this */ = definedExternally + override fun addListener(event: String /* "close" */, listener: Function<*>): ClientRequest /* this */ = + definedExternally + + override fun removeListener(event: String /* "close" */, listener: Function<*>): ClientRequest /* this */ = + definedExternally + + open fun on(event: String /* "error" */, listener: (error: Error) -> Unit): ClientRequest /* this */ = + definedExternally + + open fun once(event: String /* "error" */, listener: (error: Error) -> Unit): ClientRequest /* this */ = + definedExternally + + open fun addListener(event: String /* "error" */, listener: (error: Error) -> Unit): ClientRequest /* this */ = + definedExternally + + open fun removeListener(event: String /* "error" */, listener: (error: Error) -> Unit): ClientRequest /* this */ = + definedExternally + + override fun on(event: String /* "finish" */, listener: Function<*>): ClientRequest /* this */ = definedExternally + override fun once(event: String /* "finish" */, listener: Function<*>): ClientRequest /* this */ = definedExternally + override fun addListener(event: String /* "finish" */, listener: Function<*>): ClientRequest /* this */ = + definedExternally + + override fun removeListener(event: String /* "finish" */, listener: Function<*>): ClientRequest /* this */ = + definedExternally + + open fun on( + event: String /* "login" */, + listener: (authInfo: AuthInfo, callback: (username: String, password: String) -> Unit) -> Unit + ): ClientRequest /* this */ = definedExternally + + open fun once( + event: String /* "login" */, + listener: (authInfo: AuthInfo, callback: (username: String, password: String) -> Unit) -> Unit + ): ClientRequest /* this */ = definedExternally + + open fun addListener( + event: String /* "login" */, + listener: (authInfo: AuthInfo, callback: (username: String, password: String) -> Unit) -> Unit + ): ClientRequest /* this */ = definedExternally + + open fun removeListener( + event: String /* "login" */, + listener: (authInfo: AuthInfo, callback: (username: String, password: String) -> Unit) -> Unit + ): ClientRequest /* this */ = definedExternally + + open fun on( + eve