UNPKG

@overwolf/ow-electron

Version:

Build cross platform desktop apps with JavaScript, HTML, and CSS

1,122 lines 1.77 MB
[ { "name": "app", "description": "> Control your application's event lifecycle.\n\nProcess: Main\n\nThe following example shows how to quit the application when the last window is closed:", "slug": "app", "websiteUrl": "https://electronjs.org/docs/api/app", "repoUrl": "https://github.com/electron/electron/blob/v34.5.5/docs/api/app.md", "version": "34.5.5", "type": "Module", "process": { "main": true, "renderer": false, "utility": false, "exported": true }, "methods": [ { "name": "quit", "signature": "()", "description": "Try to close all windows. The `before-quit` event will be emitted first. If all windows are successfully closed, the `will-quit` event will be emitted and by default the application will terminate.\n\nThis method guarantees that all `beforeunload` and `unload` event handlers are correctly executed. It is possible that a window cancels the quitting by returning `false` in the `beforeunload` event handler.", "parameters": [], "returns": null, "additionalTags": [], "urlFragment": "#appquit" }, { "name": "exit", "signature": "([exitCode])", "description": "Exits immediately with `exitCode`. `exitCode` defaults to 0.\n\nAll windows will be closed immediately without asking the user, and the `before-quit` and `will-quit` events will not be emitted.", "parameters": [ { "name": "exitCode", "description": "", "required": false, "collection": false, "type": "Integer" } ], "returns": null, "additionalTags": [], "urlFragment": "#appexitexitcode" }, { "name": "relaunch", "signature": "([options])", "description": "Relaunches the app when the current instance exits.\n\nBy default, the new instance will use the same working directory and command line arguments as the current instance. When `args` is specified, the `args` will be passed as the command line arguments instead. When `execPath` is specified, the `execPath` will be executed for the relaunch instead of the current app.\n\nNote that this method does not quit the app when executed. You have to call `app.quit` or `app.exit` after calling `app.relaunch` to make the app restart.\n\nWhen `app.relaunch` is called multiple times, multiple instances will be started after the current instance exits.\n\nAn example of restarting the current instance immediately and adding a new command line argument to the new instance:", "parameters": [ { "name": "options", "description": "", "required": false, "collection": false, "type": "Object", "properties": [ { "name": "args", "description": "", "required": false, "additionalTags": [], "collection": true, "type": "String", "possibleValues": null }, { "name": "execPath", "description": "", "required": false, "additionalTags": [], "collection": false, "type": "String", "possibleValues": null } ] } ], "returns": null, "additionalTags": [], "urlFragment": "#apprelaunchoptions" }, { "name": "isReady", "signature": "()", "description": "`true` if Electron has finished initializing, `false` otherwise. See also `app.whenReady()`.", "parameters": [], "returns": { "collection": false, "type": "boolean" }, "additionalTags": [], "urlFragment": "#appisready" }, { "name": "whenReady", "signature": "()", "description": "fulfilled when Electron is initialized. May be used as a convenient alternative to checking `app.isReady()` and subscribing to the `ready` event if the app is not ready yet.", "parameters": [], "returns": { "collection": false, "type": "Promise", "innerTypes": [ { "collection": false, "type": "void" } ] }, "additionalTags": [], "urlFragment": "#appwhenready" }, { "name": "focus", "signature": "([options])", "description": "On Linux, focuses on the first visible window. On macOS, makes the application the active app. On Windows, focuses on the application's first window.\n\nYou should seek to use the `steal` option as sparingly as possible.", "parameters": [ { "name": "options", "description": "", "required": false, "collection": false, "type": "Object", "properties": [ { "name": "steal", "description": "Make the receiver the active app even if another app is currently active.", "required": true, "additionalTags": [ "os_macos" ], "collection": false, "type": "boolean" } ] } ], "returns": null, "additionalTags": [], "urlFragment": "#appfocusoptions" }, { "name": "hide", "signature": "()", "description": "Hides all application windows without minimizing them.", "parameters": [], "returns": null, "additionalTags": [ "os_macos" ], "urlFragment": "#apphide-macos" }, { "name": "isHidden", "signature": "()", "description": "`true` if the application—including all of its windows—is hidden (e.g. with `Command-H`), `false` otherwise.", "parameters": [], "returns": { "collection": false, "type": "boolean" }, "additionalTags": [ "os_macos" ], "urlFragment": "#appishidden-macos" }, { "name": "show", "signature": "()", "description": "Shows application windows after they were hidden. Does not automatically focus them.", "parameters": [], "returns": null, "additionalTags": [ "os_macos" ], "urlFragment": "#appshow-macos" }, { "name": "setAppLogsPath", "signature": "([path])", "description": "Sets or creates a directory your app's logs which can then be manipulated with `app.getPath()` or `app.setPath(pathName, newPath)`.\n\nCalling `app.setAppLogsPath()` without a `path` parameter will result in this directory being set to `~/Library/Logs/YourAppName` on _macOS_, and inside the `userData` directory on _Linux_ and _Windows_.", "parameters": [ { "name": "path", "description": "A custom path for your logs. Must be absolute.", "required": false, "collection": false, "type": "String", "possibleValues": null } ], "returns": null, "additionalTags": [], "urlFragment": "#appsetapplogspathpath" }, { "name": "getAppPath", "signature": "()", "description": "The current application directory.", "parameters": [], "returns": { "collection": false, "type": "String", "possibleValues": null }, "additionalTags": [], "urlFragment": "#appgetapppath" }, { "name": "getPath", "signature": "(name)", "description": "A path to a special directory or file associated with `name`. On failure, an `Error` is thrown.\n\nIf `app.getPath('logs')` is called without called `app.setAppLogsPath()` being called first, a default log directory will be created equivalent to calling `app.setAppLogsPath()` without a `path` parameter.", "parameters": [ { "name": "name", "description": "You can request the following paths by the name:", "required": true, "collection": false, "type": "String", "possibleValues": [ { "value": "home", "description": "" }, { "value": "appData", "description": "user application data directory, which by default points to:" }, { "value": "userData", "description": "" }, { "value": "sessionData", "description": "" }, { "value": "temp", "description": "" }, { "value": "exe", "description": "" }, { "value": "module", "description": "" }, { "value": "desktop", "description": "" }, { "value": "documents", "description": "" }, { "value": "downloads", "description": "" }, { "value": "music", "description": "" }, { "value": "pictures", "description": "" }, { "value": "videos", "description": "" }, { "value": "recent", "description": "" }, { "value": "logs", "description": "" }, { "value": "crashDumps", "description": "" } ] } ], "returns": { "collection": false, "type": "String", "possibleValues": null }, "additionalTags": [], "urlFragment": "#appgetpathname" }, { "name": "getFileIcon", "signature": "(path[, options])", "description": "fulfilled with the app's icon, which is a NativeImage.\n\nFetches a path's associated icon.\n\nOn _Windows_, there a 2 kinds of icons:\n\n* Icons associated with certain file extensions, like `.mp3`, `.png`, etc.\n* Icons inside the file itself, like `.exe`, `.dll`, `.ico`.\n\nOn _Linux_ and _macOS_, icons depend on the application associated with file mime type.", "parameters": [ { "name": "path", "description": "", "required": true, "collection": false, "type": "String", "possibleValues": null }, { "name": "options", "description": "", "required": false, "collection": false, "type": "Object", "properties": [ { "name": "size", "description": "", "required": true, "additionalTags": [], "collection": false, "type": "String", "possibleValues": [ { "value": "small", "description": "16x16" }, { "value": "normal", "description": "32x32" }, { "value": "large", "description": "48x48 on _Linux_, 32x32 on _Windows_, unsupported on _macOS_." } ] } ] } ], "returns": { "collection": false, "type": "Promise", "innerTypes": [ { "collection": false, "type": "NativeImage" } ] }, "additionalTags": [], "urlFragment": "#appgetfileiconpath-options" }, { "name": "setPath", "signature": "(name, path)", "description": "Overrides the `path` to a special directory or file associated with `name`. If the path specifies a directory that does not exist, an `Error` is thrown. In that case, the directory should be created with `fs.mkdirSync` or similar.\n\nYou can only override paths of a `name` defined in `app.getPath`.\n\nBy default, web pages' cookies and caches will be stored under the `sessionData` directory. If you want to change this location, you have to override the `sessionData` path before the `ready` event of the `app` module is emitted.", "parameters": [ { "name": "name", "description": "", "required": true, "collection": false, "type": "String", "possibleValues": null }, { "name": "path", "description": "", "required": true, "collection": false, "type": "String", "possibleValues": null } ], "returns": null, "additionalTags": [], "urlFragment": "#appsetpathname-path" }, { "name": "getVersion", "signature": "()", "description": "The version of the loaded application. If no version is found in the application's `package.json` file, the version of the current bundle or executable is returned.", "parameters": [], "returns": { "collection": false, "type": "String", "possibleValues": null }, "additionalTags": [], "urlFragment": "#appgetversion" }, { "name": "getName", "signature": "()", "description": "The current application's name, which is the name in the application's `package.json` file.\n\nUsually the `name` field of `package.json` is a short lowercase name, according to the npm modules spec. You should usually also specify a `productName` field, which is your application's full capitalized name, and which will be preferred over `name` by Electron.", "parameters": [], "returns": { "collection": false, "type": "String", "possibleValues": null }, "additionalTags": [], "urlFragment": "#appgetname" }, { "name": "setName", "signature": "(name)", "description": "Overrides the current application's name.\n\n**Note:** This function overrides the name used internally by Electron; it does not affect the name that the OS uses.", "parameters": [ { "name": "name", "description": "", "required": true, "collection": false, "type": "String", "possibleValues": null } ], "returns": null, "additionalTags": [], "urlFragment": "#appsetnamename" }, { "name": "getLocale", "signature": "()", "description": "The current application locale, fetched using Chromium's `l10n_util` library. Possible return values are documented here.\n\nTo set the locale, you'll want to use a command line switch at app startup, which may be found here.\n\n**Note:** When distributing your packaged app, you have to also ship the `locales` folder.\n\n**Note:** This API must be called after the `ready` event is emitted.\n\n**Note:** To see example return values of this API compared to other locale and language APIs, see `app.getPreferredSystemLanguages()`.", "parameters": [], "returns": { "collection": false, "type": "String", "possibleValues": null }, "additionalTags": [], "urlFragment": "#appgetlocale" }, { "name": "getLocaleCountryCode", "signature": "()", "description": "User operating system's locale two-letter ISO 3166 country code. The value is taken from native OS APIs.\n\n**Note:** When unable to detect locale country code, it returns empty string.", "parameters": [], "returns": { "collection": false, "type": "String", "possibleValues": null }, "additionalTags": [], "urlFragment": "#appgetlocalecountrycode" }, { "name": "getSystemLocale", "signature": "()", "description": "The current system locale. On Windows and Linux, it is fetched using Chromium's `i18n` library. On macOS, `[NSLocale currentLocale]` is used instead. To get the user's current system language, which is not always the same as the locale, it is better to use `app.getPreferredSystemLanguages()`.\n\nDifferent operating systems also use the regional data differently:\n\n* Windows 11 uses the regional format for numbers, dates, and times.\n* macOS Monterey uses the region for formatting numbers, dates, times, and for selecting the currency symbol to use.\n\nTherefore, this API can be used for purposes such as choosing a format for rendering dates and times in a calendar app, especially when the developer wants the format to be consistent with the OS.\n\n**Note:** This API must be called after the `ready` event is emitted.\n\n**Note:** To see example return values of this API compared to other locale and language APIs, see `app.getPreferredSystemLanguages()`.", "parameters": [], "returns": { "collection": false, "type": "String", "possibleValues": null }, "additionalTags": [], "urlFragment": "#appgetsystemlocale" }, { "name": "getPreferredSystemLanguages", "signature": "()", "description": "The user's preferred system languages from most preferred to least preferred, including the country codes if applicable. A user can modify and add to this list on Windows or macOS through the Language and Region settings.\n\nThe API uses `GlobalizationPreferences` (with a fallback to `GetSystemPreferredUILanguages`) on Windows, `\\[NSLocale preferredLanguages\\]` on macOS, and `g_get_language_names` on Linux.\n\nThis API can be used for purposes such as deciding what language to present the application in.\n\nHere are some examples of return values of the various language and locale APIs with different configurations:\n\nOn Windows, given application locale is German, the regional format is Finnish (Finland), and the preferred system languages from most to least preferred are French (Canada), English (US), Simplified Chinese (China), Finnish, and Spanish (Latin America):\n\nOn macOS, given the application locale is German, the region is Finland, and the preferred system languages from most to least preferred are French (Canada), English (US), Simplified Chinese, and Spanish (Latin America):\n\nBoth the available languages and regions and the possible return values differ between the two operating systems.\n\nAs can be seen with the example above, on Windows, it is possible that a preferred system language has no country code, and that one of the preferred system languages corresponds with the language used for the regional format. On macOS, the region serves more as a default country code: the user doesn't need to have Finnish as a preferred language to use Finland as the region,and the country code `FI` is used as the country code for preferred system languages that do not have associated countries in the language name.", "parameters": [], "returns": { "collection": true, "type": "String", "possibleValues": null }, "additionalTags": [], "urlFragment": "#appgetpreferredsystemlanguages" }, { "name": "addRecentDocument", "signature": "(path)", "description": "Adds `path` to the recent documents list.\n\nThis list is managed by the OS. On Windows, you can visit the list from the task bar, and on macOS, you can visit it from dock menu.", "parameters": [ { "name": "path", "description": "", "required": true, "collection": false, "type": "String", "possibleValues": null } ], "returns": null, "additionalTags": [ "os_macos", "os_windows" ], "urlFragment": "#appaddrecentdocumentpath-macos-windows" }, { "name": "clearRecentDocuments", "signature": "()", "description": "Clears the recent documents list.", "parameters": [], "returns": null, "additionalTags": [ "os_macos", "os_windows" ], "urlFragment": "#appclearrecentdocuments-macos-windows" }, { "name": "setAsDefaultProtocolClient", "signature": "(protocol[, path, args])", "description": "Whether the call succeeded.\n\nSets the current executable as the default handler for a protocol (aka URI scheme). It allows you to integrate your app deeper into the operating system. Once registered, all links with `your-protocol://` will be opened with the current executable. The whole link, including protocol, will be passed to your application as a parameter.\n\n**Note:** On macOS, you can only register protocols that have been added to your app's `info.plist`, which cannot be modified at runtime. However, you can change the file during build time via Electron Forge, Electron Packager, or by editing `info.plist` with a text editor. Please refer to Apple's documentation for details.\n\n**Note:** In a Windows Store environment (when packaged as an `appx`) this API will return `true` for all calls but the registry key it sets won't be accessible by other applications. In order to register your Windows Store application as a default protocol handler you must declare the protocol in your manifest.\n\nThe API uses the Windows Registry and `LSSetDefaultHandlerForURLScheme` internally.", "parameters": [ { "name": "protocol", "description": "The name of your protocol, without `://`. For example, if you want your app to handle `electron://` links, call this method with `electron` as the parameter.", "required": true, "collection": false, "type": "String", "possibleValues": null }, { "name": "path", "description": "The path to the Electron executable. Defaults to `process.execPath`", "required": false, "collection": false, "type": "String", "possibleValues": null }, { "name": "args", "description": "Arguments passed to the executable. Defaults to an empty array", "required": false, "collection": true, "type": "String", "possibleValues": null } ], "returns": { "collection": false, "type": "boolean" }, "additionalTags": [], "urlFragment": "#appsetasdefaultprotocolclientprotocol-path-args" }, { "name": "removeAsDefaultProtocolClient", "signature": "(protocol[, path, args])", "description": "Whether the call succeeded.\n\nThis method checks if the current executable as the default handler for a protocol (aka URI scheme). If so, it will remove the app as the default handler.", "parameters": [ { "name": "protocol", "description": "The name of your protocol, without `://`.", "required": true, "collection": false, "type": "String", "possibleValues": null }, { "name": "path", "description": "Defaults to `process.execPath`", "required": false, "collection": false, "type": "String", "possibleValues": null }, { "name": "args", "description": "Defaults to an empty array", "required": false, "collection": true, "type": "String", "possibleValues": null } ], "returns": { "collection": false, "type": "boolean" }, "additionalTags": [ "os_macos", "os_windows" ], "urlFragment": "#appremoveasdefaultprotocolclientprotocol-path-args-macos-windows" }, { "name": "isDefaultProtocolClient", "signature": "(protocol[, path, args])", "description": "Whether the current executable is the default handler for a protocol (aka URI scheme).\n\n**Note:** On macOS, you can use this method to check if the app has been registered as the default protocol handler for a protocol. You can also verify this by checking `~/Library/Preferences/com.apple.LaunchServices.plist` on the macOS machine. Please refer to Apple's documentation for details.\n\nThe API uses the Windows Registry and `LSCopyDefaultHandlerForURLScheme` internally.", "parameters": [ { "name": "protocol", "description": "The name of your protocol, without `://`.", "required": true, "collection": false, "type": "String", "possibleValues": null }, { "name": "path", "description": "Defaults to `process.execPath`", "required": false, "collection": false, "type": "String", "possibleValues": null }, { "name": "args", "description": "Defaults to an empty array", "required": false, "collection": true, "type": "String", "possibleValues": null } ], "returns": { "collection": false, "type": "boolean" }, "additionalTags": [], "urlFragment": "#appisdefaultprotocolclientprotocol-path-args" }, { "name": "getApplicationNameForProtocol", "signature": "(url)", "description": "Name of the application handling the protocol, or an empty string if there is no handler. For instance, if Electron is the default handler of the URL, this could be `Electron` on Windows and Mac. However, don't rely on the precise format which is not guaranteed to remain unchanged. Expect a different format on Linux, possibly with a `.desktop` suffix.\n\nThis method returns the application name of the default handler for the protocol (aka URI scheme) of a URL.", "parameters": [ { "name": "url", "description": "a URL with the protocol name to check. Unlike the other methods in this family, this accepts an entire URL, including `://` at a minimum (e.g. `https://`).", "required": true, "collection": false, "type": "String", "possibleValues": null } ], "returns": { "collection": false, "type": "String", "possibleValues": null }, "additionalTags": [], "urlFragment": "#appgetapplicationnameforprotocolurl" }, { "name": "getApplicationInfoForProtocol", "signature": "(url)", "description": "Resolve with an object containing the following:\n\n* `icon` NativeImage - the display icon of the app handling the protocol.\n* `path` string - installation path of the app handling the protocol.\n* `name` string - display name of the app handling the protocol.\n\nThis method returns a promise that contains the application name, icon and path of the default handler for the protocol (aka URI scheme) of a URL.", "parameters": [ { "name": "url", "description": "a URL with the protocol name to check. Unlike the other methods in this family, this accepts an entire URL, including `://` at a minimum (e.g. `https://`).", "required": true, "collection": false, "type": "String", "possibleValues": null } ], "returns": { "collection": false, "type": "Promise", "innerTypes": [ { "collection": false, "type": "Object", "properties": [ { "name": "icon", "description": "the display icon of the app handling the protocol.", "required": true, "additionalTags": [], "collection": false, "type": "NativeImage" }, { "name": "path", "description": "installation path of the app handling the protocol.", "required": true, "additionalTags": [], "collection": false, "type": "String", "possibleValues": null }, { "name": "name", "description": "display name of the app handling the protocol.", "required": true, "additionalTags": [], "collection": false, "type": "String", "possibleValues": null } ] } ] }, "additionalTags": [ "os_macos", "os_windows" ], "urlFragment": "#appgetapplicationinfoforprotocolurl-macos-windows" }, { "name": "setUserTasks", "signature": "(tasks)", "description": "Adds `tasks` to the Tasks category of the Jump List on Windows.\n\n`tasks` is an array of `Task` objects.\n\nWhether the call succeeded.\n\n**Note:** If you'd like to customize the Jump List even more use `app.setJumpList(categories)` instead.", "parameters": [ { "name": "tasks", "description": "Array of `Task` objects", "required": true, "collection": true, "type": "Task" } ], "returns": { "collection": false, "type": "boolean" }, "additionalTags": [ "os_windows" ], "urlFragment": "#appsetusertaskstasks-windows" }, { "name": "getJumpListSettings", "signature": "()", "description": "* `minItems` Integer - The minimum number of items that will be shown in the Jump List (for a more detailed description of this value see the MSDN docs).\n* `removedItems` JumpListItem[] - Array of `JumpListItem` objects that correspond to items that the user has explicitly removed from custom categories in the Jump List. These items must not be re-added to the Jump List in the **next** call to `app.setJumpList()`, Windows will not display any custom category that contains any of the removed items.", "parameters": [], "returns": { "collection": false, "type": "Object", "properties": [ { "name": "minItems", "description": "The minimum number of items that will be shown in the Jump List (for a more detailed description of this value see the MSDN docs).", "required": true, "additionalTags": [], "collection": false, "type": "Integer" }, { "name": "removedItems", "description": "Array of `JumpListItem` objects that correspond to items that the user has explicitly removed from custom categories in the Jump List. These items must not be re-added to the Jump List in the **next** call to `app.setJumpList()`, Windows will not display any custom category that contains any of the removed items.", "required": true, "additionalTags": [], "collection": true, "type": "JumpListItem" } ] }, "additionalTags": [ "os_windows" ], "urlFragment": "#appgetjumplistsettings-windows" }, { "name": "setJumpList", "signature": "(categories)", "description": "Sets or removes a custom Jump List for the application, and returns one of the following strings:\n\n* `ok` - Nothing went wrong.\n* `error` - One or more errors occurred, enable runtime logging to figure out the likely cause.\n* `invalidSeparatorError` - An attempt was made to add a separator to a custom category in the Jump List. Separators are only allowed in the standard `Tasks` category.\n* `fileTypeRegistrationError` - An attempt was made to add a file link to the Jump List for a file type the app isn't registered to handle.\n* `customCategoryAccessDeniedError` - Custom categories can't be added to the Jump List due to user privacy or group policy settings.\n\nIf `categories` is `null` the previously set custom Jump List (if any) will be replaced by the standard Jump List for the app (managed by Windows).\n\n**Note:** If a `JumpListCategory` object has neither the `type` nor the `name` property set then its `type` is assumed to be `tasks`. If the `name` property is set but the `type` property is omitted then the `type` is assumed to be `custom`.\n\n**Note:** Users can remove items from custom categories, and Windows will not allow a removed item to be added back into a custom category until **after** the next successful call to `app.setJumpList(categories)`. Any attempt to re-add a removed item to a custom category earlier than that will result in the entire custom category being omitted from the Jump List. The list of removed items can be obtained using `app.getJumpListSettings()`.\n\n**Note:** The maximum length of a Jump List item's `description` property is 260 characters. Beyond this limit, the item will not be added to the Jump List, nor will it be displayed.\n\nHere's a very simple example of creating a custom Jump List:", "parameters": [ { "name": "categories", "description": "Array of `JumpListCategory` objects.", "required": true, "collection": false, "type": [ { "collection": true, "type": "JumpListCategory" }, { "type": "null", "collection": false } ] } ], "returns": { "collection": false, "type": "String", "possibleValues": [ { "value": "ok", "description": "Nothing went wrong." }, { "value": "error", "description": "One or more errors occurred, enable runtime logging to figure out the likely cause." }, { "value": "invalidSeparatorError", "description": "An attempt was made to add a separator to a custom category in the Jump List. Separators are only allowed in the standard `Tasks` category." }, { "value": "fileTypeRegistrationError", "description": "An attempt was made to add a file link to the Jump List for a file type the app isn't registered to handle." }, { "value": "customCategoryAccessDeniedError", "description": "Custom categories can't be added to the Jump List due to user privacy or group policy settings." } ] }, "additionalTags": [ "os_windows" ], "urlFragment": "#appsetjumplistcategories-windows" }, { "name": "requestSingleInstanceLock", "signature": "([additionalData])", "description": "The return value of this method indicates whether or not this instance of your application successfully obtained the lock. If it failed to obtain the lock, you can assume that another instance of your application is already running with the lock and exit immediately.\n\nI.e. This method returns `true` if your process is the primary instance of your application and your app should continue loading. It returns `false` if your process should immediately quit as it has sent its parameters to another instance that has already acquired the lock.\n\nOn macOS, the system enforces single instance automatically when users try to open a second instance of your app in Finder, and the `open-file` and `open-url` events will be emitted for that. However when users start your app in command line, the system's single instance mechanism will be bypassed, and you have to use this method to ensure single instance.\n\nAn example of activating the window of primary instance when a second instance starts:", "parameters": [ { "name": "additionalData", "description": "A JSON object containing additional data to send to the first instance.", "required": false, "collection": false, "type": "Record", "innerTypes": [ { "collection": false, "type": "any" }, { "collection": false, "type": "any" } ] } ], "returns": { "collection": false, "type": "boolean" }, "additionalTags": [], "urlFragment": "#apprequestsingleinstancelockadditionaldata" }, { "name": "hasSingleInstanceLock", "signature": "()", "description": "This method returns whether or not this instance of your app is currently holding the single instance lock. You can request the lock with `app.requestSingleInstanceLock()` and release with `app.releaseSingleInstanceLock()`", "parameters": [], "returns": { "collection": false, "type": "boolean" }, "additionalTags": [], "urlFragment": "#apphassingleinstancelock" }, { "name": "releaseSingleInstanceLock", "signature": "()", "description": "Releases all locks that were created by `requestSingleInstanceLock`. This will allow multiple instances of the application to once again run side by side.", "parameters": [], "returns": null, "additionalTags": [], "urlFragment": "#appreleasesingleinstancelock" }, { "name": "setUserActivity", "signature": "(type, userInfo[, webpageURL])", "description": "Creates an `NSUserActivity` and sets it as the current activity. The activity is eligible for Handoff to another device afterward.", "parameters": [ { "name": "type", "description": "Uniquely identifies the activity. Maps to `NSUserActivity.activityType`.", "required": true, "collection": false, "type": "String", "possibleValues": null }, { "name": "userInfo", "description": "App-specific state to store for use by another device.", "required": true, "collection": false, "type": "any" }, { "name": "webpageURL", "description": "The webpage to load in a browser if no suitable app is installed on the resuming device. The scheme must be `http` or `https`.", "required": false, "collection": false, "type": "String", "possibleValues": null } ], "returns": null, "additionalTags": [ "os_macos" ], "urlFragment": "#appsetuseractivitytype-userinfo-webpageurl-macos" }, { "name": "getCurrentActivityType", "signature": "()", "description": "The type of the currently running activity.", "parameters": [], "returns": { "collection": false, "type": "String", "possibleValues": null }, "additionalTags": [ "os_macos" ], "urlFragment": "#appgetcurrentactivitytype-macos" }, { "name": "invalidateCurrentActivity", "signature": "()", "description": "Invalidates the current Handoff user activity.", "parameters": [], "returns": null, "additionalTags": [ "os_macos" ], "urlFragment": "#appinvalidatecurrentactivity-macos" }, { "name": "resignCurrentActivity", "signature": "()", "description": "Marks the current Handoff user activity as inactive without invalidating it.", "parameters": [], "returns": null, "additionalTags": [ "os_macos" ], "urlFragment": "#appresigncurrentactivity-macos" }, { "name": "updateCurrentActivity", "signature": "(type, userInfo)", "description": "Updates the current activity if its type matches `type`, merging the entries from `userInfo` into its current `userInfo` dictionary.", "parameters": [ { "name": "type", "description": "Uniquely identifies the activity. Maps to `NSUserActivity.activityType`.", "required": true, "collection": false, "type": "String", "possibleValues": null }, { "name": "userInfo", "description": "App-specific state to store for use by another device.", "required": true, "collection": false, "type": "any" } ], "returns": null, "additionalTags": [ "os_macos" ], "urlFragment": "#appupdatecurrentactivitytype-userinfo-macos" }, { "name": "setAppUserModelId", "signature": "(id)", "description": "Changes the Application User Model ID to `id`.", "parameters": [ { "name": "id", "description": "", "required": true, "collection": false, "type": "String", "possibleValues": null } ], "returns": null, "additionalTags": [ "os_windows" ], "urlFragment": "#appsetappusermodelidid-windows" }, { "name": "setActivationPolicy", "signature": "(policy)", "description": "Sets the activation policy for a given app.\n\nActivation policy types:\n\n* 'regular' - The application is an ordinary app that appears in the Dock and may have a user interface.\n* 'accessory' - The application doesn’t appear in the Dock and doesn’t have a menu bar, but it may be activated programmatically or by clicking on one of its windows.\n* 'prohibited' - The application doesn’t appear in the Dock and may not create windows or be activated.", "parameters": [ { "name": "policy", "description": "Can be 'regular', 'accessory', or 'prohibited'.", "required": true, "collection": false, "type": "String", "possibleValues": [ { "value": "regular", "description": "" }, { "value": "accessory", "description": "" }, { "value": "prohibited", "description": "" } ] } ], "returns": null, "additionalTags": [ "os_macos" ], "urlFragment": "#appsetactivationpolicypolicy-macos" }, { "name": "importCertificate", "signature": "(options, callback)", "description": "Imports the certificate in pkcs12 format into the platform certificate store. `callback` is called with the `result` of import operation, a value of `0` indicates success while any other value indicates failure according to Chromium net_error_list.", "parameters": [ { "name": "options", "description": "", "required": true, "collection": false, "type": "Object", "properties": [ { "name": "certificate", "description": "Path for the pkcs12 file.", "required": true, "additionalTags": [], "collection": false, "type": "String", "possibleValues": null }, { "name": "password", "description": "Passphrase for the certificate.", "required": true, "additionalTags": [], "collection": false, "type": "String", "possibleValues": null } ] }, { "name": "callback", "description": "", "required": true, "collection": false, "type": "Function", "parameters": [ { "name": "result", "description": "Result of import.", "required": true, "collection": false, "type": "Integer" } ], "returns": null } ], "returns": null, "additionalTags": [ "os_linux" ], "urlFragment": "#appimportcertificateoptions-callback-linux" }, { "name": "configureHostResolver", "signature": "(options)", "description": "Configures host resolution (DNS and DNS-over-HTTPS). By default, the following resolvers will be used, in order:\n\n* DNS-over-HTTPS, if the DNS provider supports it, then\n* the built-in resolver (enabled on macOS only by default), then\n* the system's resolver (e.g. `getaddrinfo`).\n\nThis can be configured to either restrict usage of non-encrypted DNS (`secureDnsMode: \"secure\"`), or disable DNS-over-HTTPS (`secureDnsMode: \"off\"`). It is also possible to enable or disable the built-in resolver.\n\nTo disable insecure DNS, you can specify a `secureDnsMode` of `\"secure\"`. If you do so, you should make sure to provide a list of DNS-over-HTTPS servers to use, in case the user's DNS configuration does not include a provider that supports DoH.\n\nThis API must be called after the `ready` event is emitted.", "parameters": [ { "name": "options", "description": "", "required": true, "collection": false, "type": "Object", "properties": [ { "name": "enableBuiltInResolver", "description": "Whether the built-in host resolver is used in preference to getaddrinfo. When enabled, the built-in resolver will attempt to use the system's DNS settings to do DNS lookups itself. Enabled by default on macOS, disabled by default on Windows and Linux.", "required": false, "additionalTags": [], "collection": false, "type": "boolean" }, { "name": "secureDnsMode", "description": "Can be 'off', 'automatic' or 'secure'. Configures the DNS-over-HTTP mode. When 'off', no DoH lookups will be performed. When 'automatic', DoH lookups will be performed first if DoH is available, and insecure DNS lookups will be performed as a fallback. When 'secure', only DoH lookups will be performed. Defaults to 'automatic'.", "required": false, "additionalTags": [], "collection": false, "type": "String", "possibleValues": [ { "value": "off", "description": "" }, { "value": "automatic", "description": "" }, { "value": "secure", "description": "" } ] }, { "name": "secureDnsServers", "description": "A list of DNS-over-HTTP server templates. See RFC8484 § 3 for details on the template format. Most servers support the POST method; the template for such servers is simply a URI. Note that for some DNS providers, the resolver will automatically upgrade to DoH unless DoH is explicitly disabled, even if there are no DoH servers provided in this list.", "required": false, "additionalTags": [], "collection": true, "type": "String", "possibleValues": null }, { "name": "enableAdditionalDnsQueryTypes", "description": "Controls whether additional DNS query types, e.g. HTTPS (DNS type 65) will be allowed besides the traditional A and AAAA queries when a request is being made via insecure DNS. Has no effect on Secure DNS which always allows additional types. Defaults to true.", "required": false, "additionalTags": [], "collection": fal