CINXE.COM
<!doctype html> <html class="docs-version-current" lang="en" dir="ltr"> <head><script type="text/javascript" src="https://web-static.archive.org/_static/js/bundle-playback.js?v=7YQSqjSh" charset="utf-8"></script> <script type="text/javascript" src="https://web-static.archive.org/_static/js/wombat.js?v=txqj7nKC" charset="utf-8"></script> <script>window.RufflePlayer=window.RufflePlayer||{};window.RufflePlayer.config={"autoplay":"on","unmuteOverlay":"hidden"};</script> <script type="text/javascript" src="https://web-static.archive.org/_static/js/ruffle/ruffle.js"></script> <script type="text/javascript"> __wm.init("https://web.archive.org/web"); __wm.wombat("https://www.electronjs.org/docs/latest/api/app","20211123055155","https://web.archive.org/","web","https://web-static.archive.org/_static/", "1637646715"); </script> <link rel="stylesheet" type="text/css" href="https://web-static.archive.org/_static/css/banner-styles.css?v=p7PEIJWi" /> <link rel="stylesheet" type="text/css" href="https://web-static.archive.org/_static/css/iconochive.css?v=3PDvdIFv" /> <!-- End Wayback Rewrite JS Include --> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width,initial-scale=1"> <meta name="generator" content="Docusaurus v2.0.0-beta.9"> <link rel="alternate" type="application/rss+xml" href="/web/20211123055155/https://www.electronjs.org/blog/rss.xml" title="Electron RSS Feed"> <link rel="alternate" type="application/atom+xml" href="/web/20211123055155/https://www.electronjs.org/blog/atom.xml" title="Electron Atom Feed"> <link rel="preconnect" href="https://web.archive.org/web/20211123055155/https://www.google-analytics.com/"> <script>window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)},ga.l=+new Date,ga("create","UA-160365006-1","auto"),ga("send","pageview")</script> <script async src="https://web.archive.org/web/20211123055155js_/https://www.google-analytics.com/analytics.js"></script> <link rel="search" type="application/opensearchdescription+xml" title="Electron" href="/web/20211123055155/https://www.electronjs.org/opensearch.xml"><title data-react-helmet="true">app | Electron</title><meta data-react-helmet="true" name="twitter:card" content="summary_large_image"><meta data-react-helmet="true" property="og:url" content="https://web.archive.org/web/20211123055155/https://electronjs.org/docs/latest/api/app"><meta data-react-helmet="true" name="docsearch:language" content="en"><meta data-react-helmet="true" name="docsearch:version" content="current"><meta data-react-helmet="true" name="docsearch:docusaurus_tag" content="docs-default-current"><meta data-react-helmet="true" property="og:title" content="app | Electron"><meta data-react-helmet="true" name="description" content="Control your application's event lifecycle."><meta data-react-helmet="true" property="og:description" content="Control your application's event lifecycle."><link data-react-helmet="true" rel="shortcut icon" href="/web/20211123055155im_/https://www.electronjs.org/assets/img/favicon.ico"><link data-react-helmet="true" rel="canonical" href="https://web.archive.org/web/20211123055155/https://electronjs.org/docs/latest/api/app"><link data-react-helmet="true" rel="alternate" href="https://web.archive.org/web/20211123055155/https://electronjs.org/docs/latest/api/app" hreflang="en"><link data-react-helmet="true" rel="alternate" href="https://web.archive.org/web/20211123055155/https://electronjs.org/de/docs/latest/api/app" hreflang="de"><link data-react-helmet="true" rel="alternate" href="https://web.archive.org/web/20211123055155/https://electronjs.org/es/docs/latest/api/app" hreflang="es"><link data-react-helmet="true" rel="alternate" href="https://web.archive.org/web/20211123055155/https://electronjs.org/fr/docs/latest/api/app" hreflang="fr"><link data-react-helmet="true" rel="alternate" href="https://web.archive.org/web/20211123055155/https://electronjs.org/ja/docs/latest/api/app" hreflang="ja"><link data-react-helmet="true" rel="alternate" href="https://web.archive.org/web/20211123055155/https://electronjs.org/pt/docs/latest/api/app" hreflang="pt"><link data-react-helmet="true" rel="alternate" href="https://web.archive.org/web/20211123055155/https://electronjs.org/ru/docs/latest/api/app" hreflang="ru"><link data-react-helmet="true" rel="alternate" href="https://web.archive.org/web/20211123055155/https://electronjs.org/zh/docs/latest/api/app" hreflang="zh"><link data-react-helmet="true" rel="alternate" href="https://web.archive.org/web/20211123055155/https://electronjs.org/docs/latest/api/app" hreflang="x-default"><link data-react-helmet="true" rel="preconnect" href="https://web.archive.org/web/20211123055155/https://bh4d9od16a-dsn.algolia.net/" crossorigin="anonymous"><link rel="stylesheet" href="/web/20211123055155cs_/https://www.electronjs.org/assets/css/styles.13175856.css"> <link rel="preload" href="/web/20211123055155/https://www.electronjs.org/assets/js/runtime~main.8dd3cf1f.js" as="script"> <link rel="preload" href="/web/20211123055155/https://www.electronjs.org/assets/js/main.924471fa.js" as="script"> </head> <body> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> <div><a href="#" class="skipToContent_1oUP">Skip to main content</a></div><nav class="navbar navbar--fixed-top navbar--dark"><div class="navbar__inner"><div class="navbar__items"><button aria-label="Navigation bar toggle" class="navbar__toggle clean-btn" type="button" tabindex="0"><svg width="30" height="30" viewbox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://web.archive.org/web/20211123055155/https://electronjs.org/" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/web/20211123055155im_/https://www.electronjs.org/assets/img/logo.svg" alt="Electron homepage" class="themedImage_1VuW themedImage--light_3UqQ"><img src="/web/20211123055155im_/https://www.electronjs.org/assets/img/logo.svg" alt="Electron homepage" class="themedImage_1VuW themedImage--dark_hz6m"></div><b class="navbar__title">Electron</b></a><a class="navbar__item navbar__link" href="/web/20211123055155/https://www.electronjs.org/docs/latest/">Docs</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/web/20211123055155/https://www.electronjs.org/docs/latest/api/app">API</a><a class="navbar__item navbar__link" href="/web/20211123055155/https://www.electronjs.org/docs/latest/tutorial/examples">Examples</a><a class="navbar__item navbar__link" href="/web/20211123055155/https://www.electronjs.org/blog">Blog</a></div><div class="navbar__items navbar__items--right"><a href="https://web.archive.org/web/20211123055155/https://releases.electronjs.org/" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link"><span>Releases<svg width="13.5" height="13.5" aria-hidden="true" viewbox="0 0 24 24" class="iconExternalLink_3J9K"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></span></a><div class="navbar__item dropdown dropdown--hoverable dropdown--right"><a class="navbar__link">16-x-y</a><ul class="dropdown__menu"><li><a href="https://web.archive.org/web/20211123055155/https://electronjs.org/docs/latest" target="_blank" rel="noopener noreferrer" class="dropdown__link"><span>16-x-y<svg width="12" height="12" aria-hidden="true" viewbox="0 0 24 24" class="iconExternalLink_3J9K"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></span></a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable dropdown--right"><a href="#" class="navbar__link"><span><svg viewbox="0 0 20 20" width="20" height="20" aria-hidden="true" class="iconLanguage_3vod"><path fill="currentColor" d="M19.753 10.909c-.624-1.707-2.366-2.726-4.661-2.726-.09 0-.176.002-.262.006l-.016-2.063 3.525-.607c.115-.019.133-.119.109-.231-.023-.111-.167-.883-.188-.976-.027-.131-.102-.127-.207-.109-.104.018-3.25.461-3.25.461l-.013-2.078c-.001-.125-.069-.158-.194-.156l-1.025.016c-.105.002-.164.049-.162.148l.033 2.307s-3.061.527-3.144.543c-.084.014-.17.053-.151.143.019.09.19 1.094.208 1.172.018.08.072.129.188.107l2.924-.504.035 2.018c-1.077.281-1.801.824-2.256 1.303-.768.807-1.207 1.887-1.207 2.963 0 1.586.971 2.529 2.328 2.695 3.162.387 5.119-3.06 5.769-4.715 1.097 1.506.256 4.354-2.094 5.98-.043.029-.098.129-.033.207l.619.756c.08.096.206.059.256.023 2.51-1.73 3.661-4.515 2.869-6.683zm-7.386 3.188c-.966-.121-.944-.914-.944-1.453 0-.773.327-1.58.876-2.156a3.21 3.21 0 011.229-.799l.082 4.277a2.773 2.773 0 01-1.243.131zm2.427-.553l.046-4.109c.084-.004.166-.01.252-.01.773 0 1.494.145 1.885.361.391.217-1.023 2.713-2.183 3.758zm-8.95-7.668a.196.196 0 00-.196-.145h-1.95a.194.194 0 00-.194.144L.008 16.916c-.017.051-.011.076.062.076h1.733c.075 0 .099-.023.114-.072l1.008-3.318h3.496l1.008 3.318c.016.049.039.072.113.072h1.734c.072 0 .078-.025.062-.076-.014-.05-3.083-9.741-3.494-11.04zm-2.618 6.318l1.447-5.25 1.447 5.25H3.226z"></path></svg><span>English</span></span></a><ul class="dropdown__menu"><li><a href="/web/20211123055155/https://www.electronjs.org/docs/latest/api/app" target="_self" rel="noopener noreferrer" class="dropdown__link dropdown__link--active" style="text-transform:capitalize">English</a></li><li><a href="/web/20211123055155/https://www.electronjs.org/de/docs/latest/api/app" target="_self" rel="noopener noreferrer" class="dropdown__link" style="text-transform:capitalize">Deutsch</a></li><li><a href="/web/20211123055155/https://www.electronjs.org/es/docs/latest/api/app" target="_self" rel="noopener noreferrer" class="dropdown__link" style="text-transform:capitalize">español</a></li><li><a href="/web/20211123055155/https://www.electronjs.org/fr/docs/latest/api/app" target="_self" rel="noopener noreferrer" class="dropdown__link" style="text-transform:capitalize">français</a></li><li><a href="/web/20211123055155/https://www.electronjs.org/ja/docs/latest/api/app" target="_self" rel="noopener noreferrer" class="dropdown__link" style="text-transform:capitalize">日本語</a></li><li><a href="/web/20211123055155/https://www.electronjs.org/pt/docs/latest/api/app" target="_self" rel="noopener noreferrer" class="dropdown__link" style="text-transform:capitalize">português</a></li><li><a href="/web/20211123055155/https://www.electronjs.org/ru/docs/latest/api/app" target="_self" rel="noopener noreferrer" class="dropdown__link" style="text-transform:capitalize">русский</a></li><li><a href="/web/20211123055155/https://www.electronjs.org/zh/docs/latest/api/app" target="_self" rel="noopener noreferrer" class="dropdown__link" style="text-transform:capitalize">中文</a></li></ul></div><a href="https://web.archive.org/web/20211123055155/https://github.com/electron/electron" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link"><span>GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewbox="0 0 24 24" class="iconExternalLink_3J9K"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></span></a><div class="toggle_71bT toggle_3Zt9 toggleDisabled_3cF-"><div class="toggleTrack_32Fl" role="button" tabindex="-1"><div class="toggleTrackCheck_3lV7"><span class="toggleIcon_O4iE">🌜</span></div><div class="toggleTrackX_S2yS"><span class="toggleIcon_O4iE">🌞</span></div><div class="toggleTrackThumb_xI_Z"></div></div><input type="checkbox" class="toggleScreenReader_28Tw" aria-label="Switch between dark and light mode"></div><div class="searchBox_1Doo"><button type="button" class="DocSearch DocSearch-Button" aria-label="Search"><span class="DocSearch-Button-Container"><svg width="20" height="20" class="DocSearch-Search-Icon" viewbox="0 0 20 20"><path d="M14.386 14.386l4.0877 4.0877-4.0877-4.0877c-2.9418 2.9419-7.7115 2.9419-10.6533 0-2.9419-2.9418-2.9419-7.7115 0-10.6533 2.9418-2.9419 7.7115-2.9419 10.6533 0 2.9419 2.9418 2.9419 7.7115 0 10.6533z" stroke="currentColor" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"></path></svg><span class="DocSearch-Button-Placeholder">Search</span></span><span class="DocSearch-Button-Keys"></span></button></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div class="main-wrapper docs-wrapper docs-doc-page"><div class="docPage_31aa"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_35hR" type="button"></button><aside class="docSidebarContainer_3Kbt"><div class="sidebar_15mo"><nav class="menu thin-scrollbar menu_Bmed"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><a class="menu__link menu__link--sublist menu__link--active" href="#">Main Process Modules</a><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/web/20211123055155/https://www.electronjs.org/docs/latest/api/app">app</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/web/20211123055155/https://www.electronjs.org/docs/latest/api/auto-updater">autoUpdater</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/web/20211123055155/https://www.electronjs.org/docs/latest/api/browser-view">BrowserView</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/web/20211123055155/https://www.electronjs.org/docs/latest/api/browser-window">BrowserWindow</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/web/20211123055155/https://www.electronjs.org/docs/latest/api/clipboard">clipboard</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/web/20211123055155/https://www.electronjs.org/docs/latest/api/content-tracing">contentTracing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/web/20211123055155/https://www.electronjs.org/docs/latest/api/crash-reporter">crashReporter</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/web/20211123055155/https://www.electronjs.org/docs/latest/api/desktop-capturer">desktopCapturer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/web/20211123055155/https://www.electronjs.org/docs/latest/api/dialog">dialog</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/web/20211123055155/https://www.electronjs.org/docs/latest/api/global-shortcut">globalShortcut</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/web/20211123055155/https://www.electronjs.org/docs/latest/api/in-app-purchase">inAppPurchase</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/web/20211123055155/https://www.electronjs.org/docs/latest/api/ipc-main">ipcMain</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/web/20211123055155/https://www.electronjs.org/docs/latest/api/menu">Menu</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/web/20211123055155/https://www.electronjs.org/docs/latest/api/message-channel-main">MessageChannelMain</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/web/20211123055155/https://www.electronjs.org/docs/latest/api/message-port-main">MessagePortMain</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/web/20211123055155/https://www.electronjs.org/docs/latest/api/native-image">nativeImage</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/web/20211123055155/https://www.electronjs.org/docs/latest/api/native-theme">nativeTheme</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/web/20211123055155/https://www.electronjs.org/docs/latest/api/net">net</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/web/20211123055155/https://www.electronjs.org/docs/latest/api/net-log">netLog</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/web/20211123055155/https://www.electronjs.org/docs/latest/api/notification">Notification</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/web/20211123055155/https://www.electronjs.org/docs/latest/api/power-monitor">powerMonitor</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/web/20211123055155/https://www.electronjs.org/docs/latest/api/power-save-blocker">powerSaveBlocker</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/web/20211123055155/https://www.electronjs.org/docs/latest/api/process">process</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/web/20211123055155/https://www.electronjs.org/docs/latest/api/protocol">protocol</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/web/20211123055155/https://www.electronjs.org/docs/latest/api/safe-storage">safeStorage</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/web/20211123055155/https://www.electronjs.org/docs/latest/api/screen">screen</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/web/20211123055155/https://www.electronjs.org/docs/latest/api/session">session</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/web/20211123055155/https://www.electronjs.org/docs/latest/api/share-menu">ShareMenu</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/web/20211123055155/https://www.electronjs.org/docs/latest/api/shell">shell</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/web/20211123055155/https://www.electronjs.org/docs/latest/api/system-preferences">systemPreferences</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/web/20211123055155/https://www.electronjs.org/docs/latest/api/touch-bar">TouchBar</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/web/20211123055155/https://www.electronjs.org/docs/latest/api/tray">Tray</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/web/20211123055155/https://www.electronjs.org/docs/latest/api/web-contents">webContents</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/web/20211123055155/https://www.electronjs.org/docs/latest/api/web-frame-main">webFrameMain</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><a class="menu__link menu__link--sublist" href="#">Renderer Process Modules</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><a class="menu__link menu__link--sublist" href="#">Custom DOM Elements</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><a class="menu__link menu__link--sublist" href="#">Chromium and Node.js</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><a class="menu__link menu__link--sublist" href="#">Classes</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><a class="menu__link menu__link--sublist" href="#">API Structures</a></li></ul></nav></div></aside><main class="docMainContainer_3ufF"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_3FnS"><div class="docItemContainer_33ec"><article><div class="tocCollapsible_1PrD theme-doc-toc-mobile tocMobile_3Hoh"><button type="button" class="clean-btn tocCollapsibleButton_2O1e">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>app</h1></header><blockquote><p>Control your application's event lifecycle.</p></blockquote><p>Process: <a href="/web/20211123055155/https://www.electronjs.org/docs/latest/glossary#main-process">Main</a></p><p>The following example shows how to quit the application when the last window is closed:</p><div class="codeBlockContainer_K1bP"><div class="codeBlockContent_hGly javascript"><pre tabindex="0" class="prism-code language-javascript codeBlock_23N8 thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_39YC"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> app </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">require</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'electron'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">app</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">on</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'window-all-closed'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> app</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">quit</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><br></span></code></pre><button type="button" aria-label="Copy code to clipboard" class="copyButton_Ue-o clean-btn">Copy</button></div></div><h2 class="anchor anchorWithStickyNavbar_31ik" id="events">Events<a aria-hidden="true" class="hash-link" href="#events" title="Direct link to heading"></a></h2><p>The <code>app</code> object emits the following events:</p><h3 class="anchor anchorWithStickyNavbar_31ik" id="event-will-finish-launching">Event: 'will-finish-launching'<a aria-hidden="true" class="hash-link" href="#event-will-finish-launching" title="Direct link to heading"></a></h3><p>Emitted when the application has finished basic startup. On Windows and Linux, the <code>will-finish-launching</code> event is the same as the <code>ready</code> event; on macOS, this event represents the <code>applicationWillFinishLaunching</code> notification of <code>NSApplication</code>. You would usually set up listeners for the <code>open-file</code> and <code>open-url</code> events here, and start the crash reporter and auto updater.</p><p>In most cases, you should do everything in the <code>ready</code> event handler.</p><h3 class="anchor anchorWithStickyNavbar_31ik" id="event-ready">Event: 'ready'<a aria-hidden="true" class="hash-link" href="#event-ready" title="Direct link to heading"></a></h3><p>Returns:</p><ul><li><code>event</code> Event</li><li><code>launchInfo</code> Record<string, any<!-- -->><!-- --> | <a aria-describedby="structures-tooltip" href="/web/20211123055155/https://www.electronjs.org/docs/latest/api/structures/notification-response" class="link_2NU_">NotificationResponse</a> <em class="badge badge--primary">macOS</em></li></ul><p>Emitted once, when Electron has finished initializing. On macOS, <code>launchInfo</code> holds the <code>userInfo</code> of the <a href="https://web.archive.org/web/20211123055155/https://developer.apple.com/documentation/foundation/nsusernotification" target="_blank" rel="noopener noreferrer"><code>NSUserNotification</code></a> or information from <a href="https://web.archive.org/web/20211123055155/https://developer.apple.com/documentation/usernotifications/unnotificationresponse" target="_blank" rel="noopener noreferrer"><code>UNNotificationResponse</code></a> that was used to open the application, if it was launched from Notification Center. You can also call <code>app.isReady()</code> to check if this event has already fired and <code>app.whenReady()</code> to get a Promise that is fulfilled when Electron is initialized.</p><h3 class="anchor anchorWithStickyNavbar_31ik" id="event-window-all-closed">Event: 'window-all-closed'<a aria-hidden="true" class="hash-link" href="#event-window-all-closed" title="Direct link to heading"></a></h3><p>Emitted when all windows have been closed.</p><p>If you do not subscribe to this event and all windows are closed, the default behavior is to quit the app; however, if you subscribe, you control whether the app quits or not. If the user pressed <code>Cmd + Q</code>, or the developer called <code>app.quit()</code>, Electron will first try to close all the windows and then emit the <code>will-quit</code> event, and in this case the <code>window-all-closed</code> event would not be emitted.</p><h3 class="anchor anchorWithStickyNavbar_31ik" id="event-before-quit">Event: 'before-quit'<a aria-hidden="true" class="hash-link" href="#event-before-quit" title="Direct link to heading"></a></h3><p>Returns:</p><ul><li><code>event</code> Event</li></ul><p>Emitted before the application starts closing its windows. Calling <code>event.preventDefault()</code> will prevent the default behavior, which is terminating the application.</p><p><strong>Note:</strong> If application quit was initiated by <code>autoUpdater.quitAndInstall()</code>, then <code>before-quit</code> is emitted <em>after</em> emitting <code>close</code> event on all windows and closing them.</p><p><strong>Note:</strong> On Windows, this event will not be emitted if the app is closed due to a shutdown/restart of the system or a user logout.</p><h3 class="anchor anchorWithStickyNavbar_31ik" id="event-will-quit">Event: 'will-quit'<a aria-hidden="true" class="hash-link" href="#event-will-quit" title="Direct link to heading"></a></h3><p>Returns:</p><ul><li><code>event</code> Event</li></ul><p>Emitted when all windows have been closed and the application will quit. Calling <code>event.preventDefault()</code> will prevent the default behavior, which is terminating the application.</p><p>See the description of the <code>window-all-closed</code> event for the differences between the <code>will-quit</code> and <code>window-all-closed</code> events.</p><p><strong>Note:</strong> On Windows, this event will not be emitted if the app is closed due to a shutdown/restart of the system or a user logout.</p><h3 class="anchor anchorWithStickyNavbar_31ik" id="event-quit">Event: 'quit'<a aria-hidden="true" class="hash-link" href="#event-quit" title="Direct link to heading"></a></h3><p>Returns:</p><ul><li><code>event</code> Event</li><li><code>exitCode</code> Integer</li></ul><p>Emitted when the application is quitting.</p><p><strong>Note:</strong> On Windows, this event will not be emitted if the app is closed due to a shutdown/restart of the system or a user logout.</p><h3 class="anchor anchorWithStickyNavbar_31ik" id="event-open-file-macos">Event: 'open-file' <em class="badge badge--primary">macOS</em><a aria-hidden="true" class="hash-link" href="#event-open-file-macos" title="Direct link to heading"></a></h3><p>Returns:</p><ul><li><code>event</code> Event</li><li><code>path</code> String</li></ul><p>Emitted when the user wants to open a file with the application. The <code>open-file</code> event is usually emitted when the application is already open and the OS wants to reuse the application to open the file. <code>open-file</code> is also emitted when a file is dropped onto the dock and the application is not yet running. Make sure to listen for the <code>open-file</code> event very early in your application startup to handle this case (even before the <code>ready</code> event is emitted).</p><p>You should call <code>event.preventDefault()</code> if you want to handle this event.</p><p>On Windows, you have to parse <code>process.argv</code> (in the main process) to get the filepath.</p><h3 class="anchor anchorWithStickyNavbar_31ik" id="event-open-url-macos">Event: 'open-url' <em class="badge badge--primary">macOS</em><a aria-hidden="true" class="hash-link" href="#event-open-url-macos" title="Direct link to heading"></a></h3><p>Returns:</p><ul><li><code>event</code> Event</li><li><code>url</code> String</li></ul><p>Emitted when the user wants to open a URL with the application. Your application's <code>Info.plist</code> file must define the URL scheme within the <code>CFBundleURLTypes</code> key, and set <code>NSPrincipalClass</code> to <code>AtomApplication</code>.</p><p>You should call <code>event.preventDefault()</code> if you want to handle this event.</p><h3 class="anchor anchorWithStickyNavbar_31ik" id="event-activate-macos">Event: 'activate' <em class="badge badge--primary">macOS</em><a aria-hidden="true" class="hash-link" href="#event-activate-macos" title="Direct link to heading"></a></h3><p>Returns:</p><ul><li><code>event</code> Event</li><li><code>hasVisibleWindows</code> Boolean</li></ul><p>Emitted when the application is activated. Various actions can trigger this event, such as launching the application for the first time, attempting to re-launch the application when it's already running, or clicking on the application's dock or taskbar icon.</p><h3 class="anchor anchorWithStickyNavbar_31ik" id="event-did-become-active-macos">Event: 'did-become-active' <em class="badge badge--primary">macOS</em><a aria-hidden="true" class="hash-link" href="#event-did-become-active-macos" title="Direct link to heading"></a></h3><p>Returns:</p><ul><li><code>event</code> Event</li></ul><p>Emitted when mac application become active. Difference from <code>activate</code> event is that <code>did-become-active</code> is emitted every time the app becomes active, not only when Dock icon is clicked or application is re-launched.</p><h3 class="anchor anchorWithStickyNavbar_31ik" id="event-continue-activity-macos">Event: 'continue-activity' <em class="badge badge--primary">macOS</em><a aria-hidden="true" class="hash-link" href="#event-continue-activity-macos" title="Direct link to heading"></a></h3><p>Returns:</p><ul><li><code>event</code> Event</li><li><code>type</code> String - A string identifying the activity. Maps to <a href="https://web.archive.org/web/20211123055155/https://developer.apple.com/library/ios/documentation/Foundation/Reference/NSUserActivity_Class/index.html#//apple_ref/occ/instp/NSUserActivity/activityType" target="_blank" rel="noopener noreferrer"><code>NSUserActivity.activityType</code></a>.</li><li><code>userInfo</code> unknown - Contains app-specific state stored by the activity on another device.</li><li><code>details</code> Object<ul><li><code>webpageURL</code> String (optional) - A string identifying the URL of the webpage accessed by the activity on another device, if available.</li></ul></li></ul><p>Emitted during <a href="https://web.archive.org/web/20211123055155/https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/Handoff/HandoffFundamentals/HandoffFundamentals.html" target="_blank" rel="noopener noreferrer">Handoff</a> when an activity from a different device wants to be resumed. You should call <code>event.preventDefault()</code> if you want to handle this event.</p><p>A user activity can be continued only in an app that has the same developer Team ID as the activity's source app and that supports the activity's type. Supported activity types are specified in the app's <code>Info.plist</code> under the <code>NSUserActivityTypes</code> key.</p><h3 class="anchor anchorWithStickyNavbar_31ik" id="event-will-continue-activity-macos">Event: 'will-continue-activity' <em class="badge badge--primary">macOS</em><a aria-hidden="true" class="hash-link" href="#event-will-continue-activity-macos" title="Direct link to heading"></a></h3><p>Returns:</p><ul><li><code>event</code> Event</li><li><code>type</code> String - A string identifying the activity. Maps to <a href="https://web.archive.org/web/20211123055155/https://developer.apple.com/library/ios/documentation/Foundation/Reference/NSUserActivity_Class/index.html#//apple_ref/occ/instp/NSUserActivity/activityType" target="_blank" rel="noopener noreferrer"><code>NSUserActivity.activityType</code></a>.</li></ul><p>Emitted during <a href="https://web.archive.org/web/20211123055155/https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/Handoff/HandoffFundamentals/HandoffFundamentals.html" target="_blank" rel="noopener noreferrer">Handoff</a> before an activity from a different device wants to be resumed. You should call <code>event.preventDefault()</code> if you want to handle this event.</p><h3 class="anchor anchorWithStickyNavbar_31ik" id="event-continue-activity-error-macos">Event: 'continue-activity-error' <em class="badge badge--primary">macOS</em><a aria-hidden="true" class="hash-link" href="#event-continue-activity-error-macos" title="Direct link to heading"></a></h3><p>Returns:</p><ul><li><code>event</code> Event</li><li><code>type</code> String - A string identifying the activity. Maps to <a href="https://web.archive.org/web/20211123055155/https://developer.apple.com/library/ios/documentation/Foundation/Reference/NSUserActivity_Class/index.html#//apple_ref/occ/instp/NSUserActivity/activityType" target="_blank" rel="noopener noreferrer"><code>NSUserActivity.activityType</code></a>.</li><li><code>error</code> String - A string with the error's localized description.</li></ul><p>Emitted during <a href="https://web.archive.org/web/20211123055155/https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/Handoff/HandoffFundamentals/HandoffFundamentals.html" target="_blank" rel="noopener noreferrer">Handoff</a> when an activity from a different device fails to be resumed.</p><h3 class="anchor anchorWithStickyNavbar_31ik" id="event-activity-was-continued-macos">Event: 'activity-was-continued' <em class="badge badge--primary">macOS</em><a aria-hidden="true" class="hash-link" href="#event-activity-was-continued-macos" title="Direct link to heading"></a></h3><p>Returns:</p><ul><li><code>event</code> Event</li><li><code>type</code> String - A string identifying the activity. Maps to <a href="https://web.archive.org/web/20211123055155/https://developer.apple.com/library/ios/documentation/Foundation/Reference/NSUserActivity_Class/index.html#//apple_ref/occ/instp/NSUserActivity/activityType" target="_blank" rel="noopener noreferrer"><code>NSUserActivity.activityType</code></a>.</li><li><code>userInfo</code> unknown - Contains app-specific state stored by the activity.</li></ul><p>Emitted during <a href="https://web.archive.org/web/20211123055155/https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/Handoff/HandoffFundamentals/HandoffFundamentals.html" target="_blank" rel="noopener noreferrer">Handoff</a> after an activity from this device was successfully resumed on another one.</p><h3 class="anchor anchorWithStickyNavbar_31ik" id="event-update-activity-state-macos">Event: 'update-activity-state' <em class="badge badge--primary">macOS</em><a aria-hidden="true" class="hash-link" href="#event-update-activity-state-macos" title="Direct link to heading"></a></h3><p>Returns:</p><ul><li><code>event</code> Event</li><li><code>type</code> String - A string identifying the activity. Maps to <a href="https://web.archive.org/web/20211123055155/https://developer.apple.com/library/ios/documentation/Foundation/Reference/NSUserActivity_Class/index.html#//apple_ref/occ/instp/NSUserActivity/activityType" target="_blank" rel="noopener noreferrer"><code>NSUserActivity.activityType</code></a>.</li><li><code>userInfo</code> unknown - Contains app-specific state stored by the activity.</li></ul><p>Emitted when <a href="https://web.archive.org/web/20211123055155/https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/Handoff/HandoffFundamentals/HandoffFundamentals.html" target="_blank" rel="noopener noreferrer">Handoff</a> is about to be resumed on another device. If you need to update the state to be transferred, you should call <code>event.preventDefault()</code> immediately, construct a new <code>userInfo</code> dictionary and call <code>app.updateCurrentActivity()</code> in a timely manner. Otherwise, the operation will fail and <code>continue-activity-error</code> will be called.</p><h3 class="anchor anchorWithStickyNavbar_31ik" id="event-new-window-for-tab-macos">Event: 'new-window-for-tab' <em class="badge badge--primary">macOS</em><a aria-hidden="true" class="hash-link" href="#event-new-window-for-tab-macos" title="Direct link to heading"></a></h3><p>Returns:</p><ul><li><code>event</code> Event</li></ul><p>Emitted when the user clicks the native macOS new tab button. The new tab button is only visible if the current <code>BrowserWindow</code> has a <code>tabbingIdentifier</code></p><h3 class="anchor anchorWithStickyNavbar_31ik" id="event-browser-window-blur">Event: 'browser-window-blur'<a aria-hidden="true" class="hash-link" href="#event-browser-window-blur" title="Direct link to heading"></a></h3><p>Returns:</p><ul><li><code>event</code> Event</li><li><code>window</code> <a href="/web/20211123055155/https://www.electronjs.org/docs/latest/api/browser-window">BrowserWindow</a></li></ul><p>Emitted when a <a href="/web/20211123055155/https://www.electronjs.org/docs/latest/api/browser-window">browserWindow</a> gets blurred.</p><h3 class="anchor anchorWithStickyNavbar_31ik" id="event-browser-window-focus">Event: 'browser-window-focus'<a aria-hidden="true" class="hash-link" href="#event-browser-window-focus" title="Direct link to heading"></a></h3><p>Returns:</p><ul><li><code>event</code> Event</li><li><code>window</code> <a href="/web/20211123055155/https://www.electronjs.org/docs/latest/api/browser-window">BrowserWindow</a></li></ul><p>Emitted when a <a href="/web/20211123055155/https://www.electronjs.org/docs/latest/api/browser-window">browserWindow</a> gets focused.</p><h3 class="anchor anchorWithStickyNavbar_31ik" id="event-browser-window-created">Event: 'browser-window-created'<a aria-hidden="true" class="hash-link" href="#event-browser-window-created" title="Direct link to heading"></a></h3><p>Returns:</p><ul><li><code>event</code> Event</li><li><code>window</code> <a href="/web/20211123055155/https://www.electronjs.org/docs/latest/api/browser-window">BrowserWindow</a></li></ul><p>Emitted when a new <a href="/web/20211123055155/https://www.electronjs.org/docs/latest/api/browser-window">browserWindow</a> is created.</p><h3 class="anchor anchorWithStickyNavbar_31ik" id="event-web-contents-created">Event: 'web-contents-created'<a aria-hidden="true" class="hash-link" href="#event-web-contents-created" title="Direct link to heading"></a></h3><p>Returns:</p><ul><li><code>event</code> Event</li><li><code>webContents</code> <a href="/web/20211123055155/https://www.electronjs.org/docs/latest/api/web-contents">WebContents</a></li></ul><p>Emitted when a new <a href="/web/20211123055155/https://www.electronjs.org/docs/latest/api/web-contents">webContents</a> is created.</p><h3 class="anchor anchorWithStickyNavbar_31ik" id="event-certificate-error">Event: 'certificate-error'<a aria-hidden="true" class="hash-link" href="#event-certificate-error" title="Direct link to heading"></a></h3><p>Returns:</p><ul><li><code>event</code> Event</li><li><code>webContents</code> <a href="/web/20211123055155/https://www.electronjs.org/docs/latest/api/web-contents">WebContents</a></li><li><code>url</code> String</li><li><code>error</code> String - The error code</li><li><code>certificate</code> <a aria-describedby="structures-tooltip" href="/web/20211123055155/https://www.electronjs.org/docs/latest/api/structures/certificate" class="link_2NU_">Certificate</a></li><li><code>callback</code> Function<ul><li><code>isTrusted</code> Boolean - Whether to consider the certificate as trusted</li></ul></li><li><code>isMainFrame</code> Boolean</li></ul><p>Emitted when failed to verify the <code>certificate</code> for <code>url</code>, to trust the certificate you should prevent the default behavior with <code>event.preventDefault()</code> and call <code>callback(true)</code>.</p><div class="codeBlockContainer_K1bP"><div class="codeBlockContent_hGly javascript"><pre tabindex="0" class="prism-code language-javascript codeBlock_23N8 thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_39YC"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> app </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">require</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'electron'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">app</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">on</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'certificate-error'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter">event</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> webContents</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> url</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> error</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> certificate</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> callback</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">if</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">url </span><span class="token operator" style="color:#393A34">===</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'https://github.com'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Verification logic.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> event</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">preventDefault</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function" style="color:#d73a49">callback</span><span class="token punctuation" style="color:#393A34">(</span><span class="token boolean" style="color:#36acaa">true</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">else</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function" style="color:#d73a49">callback</span><span class="token punctuation" style="color:#393A34">(</span><span class="token boolean" style="color:#36acaa">false</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><br></span></code></pre><button type="button" aria-label="Copy code to clipboard" class="copyButton_Ue-o clean-btn">Copy</button></div></div><h3 class="anchor anchorWithStickyNavbar_31ik" id="event-select-client-certificate">Event: 'select-client-certificate'<a aria-hidden="true" class="hash-link" href="#event-select-client-certificate" title="Direct link to heading"></a></h3><p>Returns:</p><ul><li><code>event</code> Event</li><li><code>webContents</code> <a href="/web/20211123055155/https://www.electronjs.org/docs/latest/api/web-contents">WebContents</a></li><li><code>url</code> URL</li><li><code>certificateList</code> <a aria-describedby="structures-tooltip" href="/web/20211123055155/https://www.electronjs.org/docs/latest/api/structures/certificate" class="link_2NU_">Certificate[]</a></li><li><code>callback</code> Function<ul><li><code>certificate</code> <a aria-describedby="structures-tooltip" href="/web/20211123055155/https://www.electronjs.org/docs/latest/api/structures/certificate" class="link_2NU_">Certificate</a> (optional)</li></ul></li></ul><p>Emitted when a client certificate is requested.</p><p>The <code>url</code> corresponds to the navigation entry requesting the client certificate and <code>callback</code> can be called with an entry filtered from the list. Using <code>event.preventDefault()</code> prevents the application from using the first certificate from the store.</p><div class="codeBlockContainer_K1bP"><div class="codeBlockContent_hGly javascript"><pre tabindex="0" class="prism-code language-javascript codeBlock_23N8 thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_39YC"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> app </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">require</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'electron'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">app</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">on</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'select-client-certificate'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter">event</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> webContents</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> url</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> list</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> callback</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> event</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">preventDefault</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function" style="color:#d73a49">callback</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">list</span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><br></span></code></pre><button type="button" aria-label="Copy code to clipboard" class="copyButton_Ue-o clean-btn">Copy</button></div></div><h3 class="anchor anchorWithStickyNavbar_31ik" id="event-login">Event: 'login'<a aria-hidden="true" class="hash-link" href="#event-login" title="Direct link to heading"></a></h3><p>Returns:</p><ul><li><code>event</code> Event</li><li><code>webContents</code> <a href="/web/20211123055155/https://www.electronjs.org/docs/latest/api/web-contents">WebContents</a></li><li><code>authenticationResponseDetails</code> Object<ul><li><code>url</code> URL</li></ul></li><li><code>authInfo</code> Object<ul><li><code>isProxy</code> Boolean</li><li><code>scheme</code> String</li><li><code>host</code> String</li><li><code>port</code> Integer</li><li><code>realm</code> String</li></ul></li><li><code>callback</code> Function<ul><li><code>username</code> String (optional)</li><li><code>password</code> String (optional)</li></ul></li></ul><p>Emitted when <code>webContents</code> wants to do basic auth.</p><p>The default behavior is to cancel all authentications. To override this you should prevent the default behavior with <code>event.preventDefault()</code> and call <code>callback(username, password)</code> with the credentials.</p><div class="codeBlockContainer_K1bP"><div class="codeBlockContent_hGly javascript"><pre tabindex="0" class="prism-code language-javascript codeBlock_23N8 thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_39YC"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> app </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">require</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'electron'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">app</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">on</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'login'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter">event</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> webContents</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> details</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> authInfo</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> callback</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> event</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">preventDefault</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function" style="color:#d73a49">callback</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'username'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'secret'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><br></span></code></pre><button type="button" aria-label="Copy code to clipboard" class="copyButton_Ue-o clean-btn">Copy</button></div></div><p>If <code>callback</code> is called without a username or password, the authentication request will be cancelled and the authentication error will be returned to the page.</p><h3 class="anchor anchorWithStickyNavbar_31ik" id="event-gpu-info-update">Event: 'gpu-info-update'<a aria-hidden="true" class="hash-link" href="#event-gpu-info-update" title="Direct link to heading"></a></h3><p>Emitted whenever there is a GPU info update.</p><h3 class="anchor anchorWithStickyNavbar_31ik" id="event-gpu-process-crashed-deprecated">Event: 'gpu-process-crashed' <em class="badge badge--danger">Deprecated</em><a aria-hidden="true" class="hash-link" href="#event-gpu-process-crashed-deprecated" title="Direct link to heading"></a></h3><p>Returns:</p><ul><li><code>event</code> Event</li><li><code>killed</code> Boolean</li></ul><p>Emitted when the GPU process crashes or is killed.</p><p><strong>Deprecated:</strong> This event is superceded by the <code>child-process-gone</code> event which contains more information about why the child process disappeared. It isn't always because it crashed. The <code>killed</code> boolean can be replaced by checking <code>reason === 'killed'</code> when you switch to that event.</p><h3 class="anchor anchorWithStickyNavbar_31ik" id="event-renderer-process-crashed-deprecated">Event: 'renderer-process-crashed' <em class="badge badge--danger">Deprecated</em><a aria-hidden="true" class="hash-link" href="#event-renderer-process-crashed-deprecated" title="Direct link to heading"></a></h3><p>Returns:</p><ul><li><code>event</code> Event</li><li><code>webContents</code> <a href="/web/20211123055155/https://www.electronjs.org/docs/latest/api/web-contents">WebContents</a></li><li><code>killed</code> Boolean</li></ul><p>Emitted when the renderer process of <code>webContents</code> crashes or is killed.</p><p><strong>Deprecated:</strong> This event is superceded by the <code>render-process-gone</code> event which contains more information about why the render process disappeared. It isn't always because it crashed. The <code>killed</code> boolean can be replaced by checking <code>reason === 'killed'</code> when you switch to that event.</p><h3 class="anchor anchorWithStickyNavbar_31ik" id="event-render-process-gone">Event: 'render-process-gone'<a aria-hidden="true" class="hash-link" href="#event-render-process-gone" title="Direct link to heading"></a></h3><p>Returns:</p><ul><li><code>event</code> Event</li><li><code>webContents</code> <a href="/web/20211123055155/https://www.electronjs.org/docs/latest/api/web-contents">WebContents</a></li><li><code>details</code> Object<ul><li><code>reason</code> String - The reason the render process is gone. Possible values:<ul><li><code>clean-exit</code> - Process exited with an exit code of zero</li><li><code>abnormal-exit</code> - Process exited with a non-zero exit code</li><li><code>killed</code> - Process was sent a SIGTERM or otherwise killed externally</li><li><code>crashed</code> - Process crashed</li><li><code>oom</code> - Process ran out of memory</li><li><code>launch-failed</code> - Process never successfully launched</li><li><code>integrity-failure</code> - Windows code integrity checks failed</li></ul></li><li><code>exitCode</code> Integer - The exit code of the process, unless <code>reason</code> is <code>launch-failed</code>, in which case <code>exitCode</code> will be a platform-specific launch failure error code.</li></ul></li></ul><p>Emitted when the renderer process unexpectedly disappears. This is normally because it was crashed or killed.</p><h3 class="anchor anchorWithStickyNavbar_31ik" id="event-child-process-gone">Event: 'child-process-gone'<a aria-hidden="true" class="hash-link" href="#event-child-process-gone" title="Direct link to heading"></a></h3><p>Returns:</p><ul><li><code>event</code> Event</li><li><code>details</code> Object<ul><li><code>type</code> String - Process type. One of the following values:<ul><li><code>Utility</code></li><li><code>Zygote</code></li><li><code>Sandbox helper</code></li><li><code>GPU</code></li><li><code>Pepper Plugin</code></li><li><code>Pepper Plugin Broker</code></li><li><code>Unknown</code></li></ul></li><li><code>reason</code> String - The reason the child process is gone. Possible values:<ul><li><code>clean-exit</code> - Process exited with an exit code of zero</li><li><code>abnormal-exit</code> - Process exited with a non-zero exit code</li><li><code>killed</code> - Process was sent a SIGTERM or otherwise killed externally</li><li><code>crashed</code> - Process crashed</li><li><code>oom</code> - Process ran out of memory</li><li><code>launch-failed</code> - Process never successfully launched</li><li><code>integrity-failure</code> - Windows code integrity checks failed</li></ul></li><li><code>exitCode</code> Number - The exit code for the process (e.g. status from waitpid if on posix, from GetExitCodeProcess on Windows).</li><li><code>serviceName</code> String (optional) - The non-localized name of the process.</li><li><code>name</code> String (optional) - The name of the process. Examples for utility: <code>Audio Service</code>, <code>Content Decryption Module Service</code>, <code>Network Service</code>, <code>Video Capture</code>, etc.</li></ul></li></ul><p>Emitted when the child process unexpectedly disappears. This is normally because it was crashed or killed. It does not include renderer processes.</p><h3 class="anchor anchorWithStickyNavbar_31ik" id="event-accessibility-support-changed-macos-windows">Event: 'accessibility-support-changed' <em class="badge badge--primary">macOS</em> <em class="badge badge--primary">Windows</em><a aria-hidden="true" class="hash-link" href="#event-accessibility-support-changed-macos-windows" title="Direct link to heading"></a></h3><p>Returns:</p><ul><li><code>event</code> Event</li><li><code>accessibilitySupportEnabled</code> Boolean - <code>true</code> when Chrome's accessibility support is enabled, <code>false</code> otherwise.</li></ul><p>Emitted when Chrome's accessibility support changes. This event fires when assistive technologies, such as screen readers, are enabled or disabled. See <a href="https://web.archive.org/web/20211123055155/https://www.chromium.org/developers/design-documents/accessibility" target="_blank" rel="noopener noreferrer">https://www.chromium.org/developers/design-documents/accessibility</a> for more details.</p><h3 class="anchor anchorWithStickyNavbar_31ik" id="event-session-created">Event: 'session-created'<a aria-hidden="true" class="hash-link" href="#event-session-created" title="Direct link to heading"></a></h3><p>Returns:</p><ul><li><code>session</code> <a href="/web/20211123055155/https://www.electronjs.org/docs/latest/api/session">Session</a></li></ul><p>Emitted when Electron has created a new <code>session</code>.</p><div class="codeBlockContainer_K1bP"><div class="codeBlockContent_hGly javascript"><pre tabindex="0" class="prism-code language-javascript codeBlock_23N8 thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_39YC"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> app </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">require</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'electron'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">app</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">on</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'session-created'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter">session</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">session</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><br></span></code></pre><button type="button" aria-label="Copy code to clipboard" class="copyButton_Ue-o clean-btn">Copy</button></div></div><h3 class="anchor anchorWithStickyNavbar_31ik" id="event-second-instance">Event: 'second-instance'<a aria-hidden="true" class="hash-link" href="#event-second-instance" title="Direct link to heading"></a></h3><p>Returns:</p><ul><li><code>event</code> Event</li><li><code>argv</code> String[] - An array of the second instance's command line arguments</li><li><code>workingDirectory</code> String - The second instance's working directory</li><li><code>additionalData</code> unknown - A JSON object of additional data passed from the second instance</li></ul><p>This event will be emitted inside the primary instance of your application when a second instance has been executed and calls <code>app.requestSingleInstanceLock()</code>.</p><p><code>argv</code> is an Array of the second instance's command line arguments, and <code>workingDirectory</code> is its current working directory. Usually applications respond to this by making their primary window focused and non-minimized.</p><p><strong>Note:</strong> If the second instance is started by a different user than the first, the <code>argv</code> array will not include the arguments.</p><p>This event is guaranteed to be emitted after the <code>ready</code> event of <code>app</code> gets emitted.</p><p><strong>Note:</strong> Extra command line arguments might be added by Chromium, such as <code>--original-process-start-time</code>.</p><h3 class="anchor anchorWithStickyNavbar_31ik" id="event-desktop-capturer-get-sources">Event: 'desktop-capturer-get-sources'<a aria-hidden="true" class="hash-link" href="#event-desktop-capturer-get-sources" title="Direct link to heading"></a></h3><p>Returns:</p><ul><li><code>event</code> Event</li><li><code>webContents</code> <a href="/web/20211123055155/https://www.electronjs.org/docs/latest/api/web-contents">WebContents</a></li></ul><p>Emitted when <code>desktopCapturer.getSources()</code> is called in the renderer process of <code>webContents</code>. Calling <code>event.preventDefault()</code> will make it return empty sources.</p><h2 class="anchor anchorWithStickyNavbar_31ik" id="methods">Methods<a aria-hidden="true" class="hash-link" href="#methods" title="Direct link to heading"></a></h2><p>The <code>app</code> object has the following methods:</p><p><strong>Note:</strong> Some methods are only available on specific operating systems and are labeled as such.</p><h3 class="anchor anchorWithStickyNavbar_31ik" id="appquit"><code>app.quit()</code><a aria-hidden="true" class="hash-link" href="#appquit" title="Direct link to heading"></a></h3><p>Try to close all windows. The <code>before-quit</code> event will be emitted first. If all windows are successfully closed, the <code>will-quit</code> event will be emitted and by default the application will terminate.</p><p>This method guarantees that all <code>beforeunload</code> and <code>unload</code> event handlers are correctly executed. It is possible that a window cancels the quitting by returning <code>false</code> in the <code>beforeunload</code> event handler.</p><h3 class="anchor anchorWithStickyNavbar_31ik" id="appexitexitcode"><code>app.exit([exitCode])</code><a aria-hidden="true" class="hash-link" href="#appexitexitcode" title="Direct link to heading"></a></h3><ul><li><code>exitCode</code> Integer (optional)</li></ul><p>Exits immediately with <code>exitCode</code>. <code>exitCode</code> defaults to 0.</p><p>All windows will be closed immediately without asking the user, and the <code>before-quit</code> and <code>will-quit</code> events will not be emitted.</p><h3 class="anchor anchorWithStickyNavbar_31ik" id="apprelaunchoptions"><code>app.relaunch([options])</code><a aria-hidden="true" class="hash-link" href="#apprelaunchoptions" title="Direct link to heading"></a></h3><ul><li><code>options</code> Object (optional)<ul><li><code>args</code> String[] (optional)</li><li><code>execPath</code> String (optional)</li></ul></li></ul><p>Relaunches the app when current instance exits.</p><p>By default, the new instance will use the same working directory and command line arguments with current instance. When <code>args</code> is specified, the <code>args</code> will be passed as command line arguments instead. When <code>execPath</code> is specified, the <code>execPath</code> will be executed for relaunch instead of current app.</p><p>Note that this method does not quit the app when executed, you have to call <code>app.quit</code> or <code>app.exit</code> after calling <code>app.relaunch</code> to make the app restart.</p><p>When <code>app.relaunch</code> is called for multiple times, multiple instances will be started after current instance exited.</p><p>An example of restarting current instance immediately and adding a new command line argument to the new instance:</p><div class="codeBlockContainer_K1bP"><div class="codeBlockContent_hGly javascript"><pre tabindex="0" class="prism-code language-javascript codeBlock_23N8 thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_39YC"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> app </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">require</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'electron'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">app</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">relaunch</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> args</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> process</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">argv</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">slice</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">concat</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">'--relaunch'</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">app</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">exit</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">)</span><br></span></code></pre><button type="button" aria-label="Copy code to clipboard" class="copyButton_Ue-o clean-btn">Copy</button></div></div><h3 class="anchor anchorWithStickyNavbar_31ik" id="appisready"><code>app.isReady()</code><a aria-hidden="true" class="hash-link" href="#appisready" title="Direct link to heading"></a></h3><p>Returns <code>Boolean</code> - <code>true</code> if Electron has finished initializing, <code>false</code> otherwise. See also <code>app.whenReady()</code>.</p><h3 class="anchor anchorWithStickyNavbar_31ik" id="appwhenready"><code>app.whenReady()</code><a aria-hidden="true" class="hash-link" href="#appwhenready" title="Direct link to heading"></a></h3><p>Returns <code>Promise<void></code> - fulfilled when Electron is initialized. May be used as a convenient alternative to checking <code>app.isReady()</code> and subscribing to the <code>ready</code> event if the app is not ready yet.</p><h3 class="anchor anchorWithStickyNavbar_31ik" id="appfocusoptions"><code>app.focus([options])</code><a aria-hidden="true" class="hash-link" href="#appfocusoptions" title="Direct link to heading"></a></h3><ul><li><code>options</code> Object (optional)<ul><li><code>steal</code> Boolean <em class="badge badge--primary">macOS</em> - Make the receiver the active app even if another app is currently active.</li></ul></li></ul><p>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.</p><p>You should seek to use the <code>steal</code> option as sparingly as possible.</p><h3 class="anchor anchorWithStickyNavbar_31ik" id="apphide-macos"><code>app.hide()</code> <em class="badge badge--primary">macOS</em><a aria-hidden="true" class="hash-link" href="#apphide-macos" title="Direct link to heading"></a></h3><p>Hides all application windows without minimizing them.</p><h3 class="anchor anchorWithStickyNavbar_31ik" id="appshow-macos"><code>app.show()</code> <em class="badge badge--primary">macOS</em><a aria-hidden="true" class="hash-link" href="#appshow-macos" title="Direct link to heading"></a></h3><p>Shows application windows after they were hidden. Does not automatically focus them.</p><h3 class="anchor anchorWithStickyNavbar_31ik" id="appsetapplogspathpath"><code>app.setAppLogsPath([path])</code><a aria-hidden="true" class="hash-link" href="#appsetapplogspathpath" title="Direct link to heading"></a></h3><ul><li><code>path</code> String (optional) - A custom path for your logs. Must be absolute.</li></ul><p>Sets or creates a directory your app's logs which can then be manipulated with <code>app.getPath()</code> or <code>app.setPath(pathName, newPath)</code>.</p><p>Calling <code>app.setAppLogsPath()</code> without a <code>path</code> parameter will result in this directory being set to <code>~/Library/Logs/YourAppName</code> on <em class="badge badge--primary">macOS</em>, and inside the <code>userData</code> directory on <em class="badge badge--primary">Linux</em> and <em class="badge badge--primary">Windows</em>.</p><h3 class="anchor anchorWithStickyNavbar_31ik" id="appgetapppath"><code>app.getAppPath()</code><a aria-hidden="true" class="hash-link" href="#appgetapppath" title="Direct link to heading"></a></h3><p>Returns <code>String</code> - The current application directory.</p><h3 class="anchor anchorWithStickyNavbar_31ik" id="appgetpathname"><code>app.getPath(name)</code><a aria-hidden="true" class="hash-link" href="#appgetpathname" title="Direct link to heading"></a></h3><ul><li><code>name</code> String - You can request the following paths by the name:<ul><li><code>home</code> User's home directory.</li><li><code>appData</code> Per-user application data directory, which by default points to:<ul><li><code>%APPDATA%</code> on Windows</li><li><code>$XDG_CONFIG_HOME</code> or <code>~/.config</code> on Linux</li><li><code>~/Library/Application Support</code> on macOS</li></ul></li><li><code>userData</code> The directory for storing your app's configuration files, which by default it is the <code>appData</code> directory appended with your app's name.</li><li><code>cache</code></li><li><code>temp</code> Temporary directory.</li><li><code>exe</code> The current executable file.</li><li><code>module</code> The <code>libchromiumcontent</code> library.</li><li><code>desktop</code> The current user's Desktop directory.</li><li><code>documents</code> Directory for a user's "My Documents".</li><li><code>downloads</code> Directory for a user's downloads.</li><li><code>music</code> Directory for a user's music.</li><li><code>pictures</code> Directory for a user's pictures.</li><li><code>videos</code> Directory for a user's videos.</li><li><code>recent</code> Directory for the user's recent files (Windows only).</li><li><code>logs</code> Directory for your app's log folder.</li><li><code>crashDumps</code> Directory where crash dumps are stored.</li></ul></li></ul><p>Returns <code>String</code> - A path to a special directory or file associated with <code>name</code>. On failure, an <code>Error</code> is thrown.</p><p>If <code>app.getPath('logs')</code> is called without called <code>app.setAppLogsPath()</code> being called first, a default log directory will be created equivalent to calling <code>app.setAppLogsPath()</code> without a <code>path</code> parameter.</p><h3 class="anchor anchorWithStickyNavbar_31ik" id="appgetfileiconpath-options"><code>app.getFileIcon(path[, options])</code><a aria-hidden="true" class="hash-link" href="#appgetfileiconpath-options" title="Direct link to heading"></a></h3><ul><li><code>path</code> String</li><li><code>options</code> Object (optional)<ul><li><code>size</code> String<ul><li><code>small</code> - 16x16</li><li><code>normal</code> - 32x32</li><li><code>large</code> - 48x48 on <em class="badge badge--primary">Linux</em>, 32x32 on <em class="badge badge--primary">Windows</em>, unsupported on <em class="badge badge--primary">macOS</em>.</li></ul></li></ul></li></ul><p>Returns <code>Promise<NativeImage></code> - fulfilled with the app's icon, which is a <a href="/web/20211123055155/https://www.electronjs.org/docs/latest/api/native-image">NativeImage</a>.</p><p>Fetches a path's associated icon.</p><p>On <em class="badge badge--primary">Windows</em>, there a 2 kinds of icons:</p><ul><li>Icons associated with certain file extensions, like <code>.mp3</code>, <code>.png</code>, etc.</li><li>Icons inside the file itself, like <code>.exe</code>, <code>.dll</code>, <code>.ico</code>.</li></ul><p>On <em class="badge badge--primary">Linux</em> and <em class="badge badge--primary">macOS</em>, icons depend on the application associated with file mime type.</p><h3 class="anchor anchorWithStickyNavbar_31ik" id="appsetpathname-path"><code>app.setPath(name, path)</code><a aria-hidden="true" class="hash-link" href="#appsetpathname-path" title="Direct link to heading"></a></h3><ul><li><code>name</code> String</li><li><code>path</code> String</li></ul><p>Overrides the <code>path</code> to a special directory or file associated with <code>name</code>. If the path specifies a directory that does not exist, an <code>Error</code> is thrown. In that case, the directory should be created with <code>fs.mkdirSync</code> or similar.</p><p>You can only override paths of a <code>name</code> defined in <code>app.getPath</code>.</p><p>By default, web pages' cookies and caches will be stored under the <code>userData</code> directory. If you want to change this location, you have to override the <code>userData</code> path before the <code>ready</code> event of the <code>app</code> module is emitted.</p><h3 class="anchor anchorWithStickyNavbar_31ik" id="appgetversion"><code>app.getVersion()</code><a aria-hidden="true" class="hash-link" href="#appgetversion" title="Direct link to heading"></a></h3><p>Returns <code>String</code> - The version of the loaded application. If no version is found in the application's <code>package.json</code> file, the version of the current bundle or executable is returned.</p><h3 class="anchor anchorWithStickyNavbar_31ik" id="appgetname"><code>app.getName()</code><a aria-hidden="true" class="hash-link" href="#appgetname" title="Direct link to heading"></a></h3><p>Returns <code>String</code> - The current application's name, which is the name in the application's <code>package.json</code> file.</p><p>Usually the <code>name</code> field of <code>package.json</code> is a short lowercase name, according to the npm modules spec. You should usually also specify a <code>productName</code> field, which is your application's full capitalized name, and which will be preferred over <code>name</code> by Electron.</p><h3 class="anchor anchorWithStickyNavbar_31ik" id="appsetnamename"><code>app.setName(name)</code><a aria-hidden="true" class="hash-link" href="#appsetnamename" title="Direct link to heading"></a></h3><ul><li><code>name</code> String</li></ul><p>Overrides the current application's name.</p><p><strong>Note:</strong> This function overrides the name used internally by Electron; it does not affect the name that the OS uses.</p><h3 class="anchor anchorWithStickyNavbar_31ik" id="appgetlocale"><code>app.getLocale()</code><a aria-hidden="true" class="hash-link" href="#appgetlocale" title="Direct link to heading"></a></h3><p>Returns <code>String</code> - The current application locale, fetched using Chromium's <code>l10n_util</code> library. Possible return values are documented <a href="https://web.archive.org/web/20211123055155/https://source.chromium.org/chromium/chromium/src/+/master:ui/base/l10n/l10n_util.cc" target="_blank" rel="noopener noreferrer">here</a>.</p><p>To set the locale, you'll want to use a command line switch at app startup, which may be found <a href="/web/20211123055155/https://www.electronjs.org/docs/latest/api/command-line-switches">here</a>.</p><p><strong>Note:</strong> When distributing your packaged app, you have to also ship the <code>locales</code> folder.</p><p><strong>Note:</strong> On Windows, you have to call it after the <code>ready</code> events gets emitted.</p><h3 class="anchor anchorWithStickyNavbar_31ik" id="appgetlocalecountrycode"><code>app.getLocaleCountryCode()</code><a aria-hidden="true" class="hash-link" href="#appgetlocalecountrycode" title="Direct link to heading"></a></h3><p>Returns <code>String</code> - User operating system's locale two-letter <a href="https://web.archive.org/web/20211123055155/https://www.iso.org/iso-3166-country-codes.html" target="_blank" rel="noopener noreferrer">ISO 3166</a> country code. The value is taken from native OS APIs.</p><p><strong>Note:</strong> When unable to detect locale country code, it returns empty string.</p><h3 class="anchor anchorWithStickyNavbar_31ik" id="appaddrecentdocumentpath-macos-windows"><code>app.addRecentDocument(path)</code> <em class="badge badge--primary">macOS</em> <em class="badge badge--primary">Windows</em><a aria-hidden="true" class="hash-link" href="#appaddrecentdocumentpath-macos-windows" title="Direct link to heading"></a></h3><ul><li><code>path</code> String</li></ul><p>Adds <code>path</code> to the recent documents list.</p><p>This 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.</p><h3 class="anchor anchorWithStickyNavbar_31ik" id="appclearrecentdocuments-macos-windows"><code>app.clearRecentDocuments()</code> <em class="badge badge--primary">macOS</em> <em class="badge badge--primary">Windows</em><a aria-hidden="true" class="hash-link" href="#appclearrecentdocuments-macos-windows" title="Direct link to heading"></a></h3><p>Clears the recent documents list.</p><h3 class="anchor anchorWithStickyNavbar_31ik" id="appsetasdefaultprotocolclientprotocol-path-args"><code>app.setAsDefaultProtocolClient(protocol[, path, args])</code><a aria-hidden="true" class="hash-link" href="#appsetasdefaultprotocolclientprotocol-path-args" title="Direct link to heading"></a></h3><ul><li><code>protocol</code> String - The name of your protocol, without <code>://</code>. For example, if you want your app to handle <code>electron://</code> links, call this method with <code>electron</code> as the parameter.</li><li><code>path</code> String (optional) <em class="badge badge--primary">Windows</em> - The path to the Electron executable. Defaults to <code>process.execPath</code></li><li><code>args</code> String[] (optional) <em class="badge badge--primary">Windows</em> - Arguments passed to the executable. Defaults to an empty array</li></ul><p>Returns <code>Boolean</code> - Whether the call succeeded.</p><p>Sets 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 <code>your-protocol://</code> will be opened with the current executable. The whole link, including protocol, will be passed to your application as a parameter.</p><p><strong>Note:</strong> On macOS, you can only register protocols that have been added to your app's <code>info.plist</code>, which cannot be modified at runtime. However, you can change the file during build time via <a href="https://web.archive.org/web/20211123055155/https://www.electronforge.io/" target="_blank" rel="noopener noreferrer">Electron Forge</a>, <a href="https://web.archive.org/web/20211123055155/https://github.com/electron/electron-packager" target="_blank" rel="noopener noreferrer">Electron Packager</a>, or by editing <code>info.plist</code> with a text editor. Please refer to <a href="https://web.archive.org/web/20211123055155/https://developer.apple.com/library/ios/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html#//apple_ref/doc/uid/TP40009249-102207-TPXREF115" target="_blank" rel="noopener noreferrer">Apple's documentation</a> for details.</p><p><strong>Note:</strong> In a Windows Store environment (when packaged as an <code>appx</code>) this API will return <code>true</code> 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 <a href="https://web.archive.org/web/20211123055155/https://docs.microsoft.com/en-us/uwp/schemas/appxpackage/uapmanifestschema/element-uap-protocol" target="_blank" rel="noopener noreferrer">declare the protocol in your manifest</a>.</p><p>The API uses the Windows Registry and <code>LSSetDefaultHandlerForURLScheme</code> internally.</p><h3 class="anchor anchorWithStickyNavbar_31ik" id="appremoveasdefaultprotocolclientprotocol-path-args-macos-windows"><code>app.removeAsDefaultProtocolClient(protocol[, path, args])</code> <em class="badge badge--primary">macOS</em> <em class="badge badge--primary">Windows</em><a aria-hidden="true" class="hash-link" href="#appremoveasdefaultprotocolclientprotocol-path-args-macos-windows" title="Direct link to heading"></a></h3><ul><li><code>protocol</code> String - The name of your protocol, without <code>://</code>.</li><li><code>path</code> String (optional) <em class="badge badge--primary">Windows</em> - Defaults to <code>process.execPath</code></li><li><code>args</code> String[] (optional) <em class="badge badge--primary">Windows</em> - Defaults to an empty array</li></ul><p>Returns <code>Boolean</code> - Whether the call succeeded.</p><p>This 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.</p><h3 class="anchor anchorWithStickyNavbar_31ik" id="appisdefaultprotocolclientprotocol-path-args"><code>app.isDefaultProtocolClient(protocol[, path, args])</code><a aria-hidden="true" class="hash-link" href="#appisdefaultprotocolclientprotocol-path-args" title="Direct link to heading"></a></h3><ul><li><code>protocol</code> String - The name of your protocol, without <code>://</code>.</li><li><code>path</code> String (optional) <em class="badge badge--primary">Windows</em> - Defaults to <code>process.execPath</code></li><li><code>args</code> String[] (optional) <em class="badge badge--primary">Windows</em> - Defaults to an empty array</li></ul><p>Returns <code>Boolean</code> - Whether the current executable is the default handler for a protocol (aka URI scheme).</p><p><strong>Note:</strong> 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 <code>~/Library/Preferences/com.apple.LaunchServices.plist</code> on the macOS machine. Please refer to <a href="https://web.archive.org/web/20211123055155/https://developer.apple.com/library/mac/documentation/Carbon/Reference/LaunchServicesReference/#//apple_ref/c/func/LSCopyDefaultHandlerForURLScheme" target="_blank" rel="noopener noreferrer">Apple's documentation</a> for details.</p><p>The API uses the Windows Registry and <code>LSCopyDefaultHandlerForURLScheme</code> internally.</p><h3 class="anchor anchorWithStickyNavbar_31ik" id="appgetapplicationnameforprotocolurl"><code>app.getApplicationNameForProtocol(url)</code><a aria-hidden="true" class="hash-link" href="#appgetapplicationnameforprotocolurl" title="Direct link to heading"></a></h3><ul><li><code>url</code> String - a URL with the protocol name to check. Unlike the other methods in this family, this accepts an entire URL, including <code>://</code> at a minimum (e.g. <code>https://</code>).</li></ul><p>Returns <code>String</code> - 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 <code>Electron</code> 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 <code>.desktop</code> suffix.</p><p>This method returns the application name of the default handler for the protocol (aka URI scheme) of a URL.</p><h3 class="anchor anchorWithStickyNavbar_31ik" id="appgetapplicationinfoforprotocolurl-macos-windows"><code>app.getApplicationInfoForProtocol(url)</code> <em class="badge badge--primary">macOS</em> <em class="badge badge--primary">Windows</em><a aria-hidden="true" class="hash-link" href="#appgetapplicationinfoforprotocolurl-macos-windows" title="Direct link to heading"></a></h3><ul><li><code>url</code> String - a URL with the protocol name to check. Unlike the other methods in this family, this accepts an entire URL, including <code>://</code> at a minimum (e.g. <code>https://</code>).</li></ul><p>Returns <code>Promise<Object></code> - Resolve with an object containing the following:</p><ul><li><code>icon</code> NativeImage - the display icon of the app handling the protocol.</li><li><code>path</code> String - installation path of the app handling the protocol.</li><li><code>name</code> String - display name of the app handling the protocol.</li></ul><p>This 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.</p><h3 class="anchor anchorWithStickyNavbar_31ik" id="appsetusertaskstasks-windows"><code>app.setUserTasks(tasks)</code> <em class="badge badge--primary">Windows</em><a aria-hidden="true" class="hash-link" href="#appsetusertaskstasks-windows" title="Direct link to heading"></a></h3><ul><li><code>tasks</code> <a aria-describedby="structures-tooltip" href="/web/20211123055155/https://www.electronjs.org/docs/latest/api/structures/task" class="link_2NU_">Task[]</a> - Array of <code>Task</code> objects</li></ul><p>Adds <code>tasks</code> to the <a href="https://web.archive.org/web/20211123055155/https://msdn.microsoft.com/en-us/library/windows/desktop/dd378460(v=vs.85).aspx#tasks" target="_blank" rel="noopener noreferrer">Tasks</a> category of the Jump List on Windows.</p><p><code>tasks</code> is an array of <a aria-describedby="structures-tooltip" href="/web/20211123055155/https://www.electronjs.org/docs/latest/api/structures/task" class="link_2NU_">Task</a> objects.</p><p>Returns <code>Boolean</code> - Whether the call succeeded.</p><p><strong>Note:</strong> If you'd like to customize the Jump List even more use <code>app.setJumpList(categories)</code> instead.</p><h3 class="anchor anchorWithStickyNavbar_31ik" id="appgetjumplistsettings-windows"><code>app.getJumpListSettings()</code> <em class="badge badge--primary">Windows</em><a aria-hidden="true" class="hash-link" href="#appgetjumplistsettings-windows" title="Direct link to heading"></a></h3><p>Returns <code>Object</code>:</p><ul><li><code>minItems</code> Integer - The minimum number of items that will be shown in the Jump List (for a more detailed description of this value see the <a href="https://web.archive.org/web/20211123055155/https://msdn.microsoft.com/en-us/library/windows/desktop/dd378398(v=vs.85).aspx" target="_blank" rel="noopener noreferrer">MSDN docs</a>).</li><li><code>removedItems</code> <a aria-describedby="structures-tooltip" href="/web/20211123055155/https://www.electronjs.org/docs/latest/api/structures/jump-list-item" class="link_2NU_">JumpListItem[]</a> - Array of <code>JumpListItem</code> 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 <strong>next</strong> call to <code>app.setJumpList()</code>, Windows will not display any custom category that contains any of the removed items.</li></ul><h3 class="anchor anchorWithStickyNavbar_31ik" id="appsetjumplistcategories-windows"><code>app.setJumpList(categories)</code> <em class="badge badge--primary">Windows</em><a aria-hidden="true" class="hash-link" href="#appsetjumplistcategories-windows" title="Direct link to heading"></a></h3><ul><li><code>categories</code> <a aria-describedby="structures-tooltip" href="/web/20211123055155/https://www.electronjs.org/docs/latest/api/structures/jump-list-category" class="link_2NU_">JumpListCategory[]</a> | <code>null</code> - Array of <code>JumpListCategory</code> objects.</li></ul><p>Sets or removes a custom Jump List for the application, and returns one of the following strings:</p><ul><li><code>ok</code> - Nothing went wrong.</li><li><code>error</code> - One or more errors occurred, enable runtime logging to figure out the likely cause.</li><li><code>invalidSeparatorError</code> - An attempt was made to add a separator to a custom category in the Jump List. Separators are only allowed in the standard <code>Tasks</code> category.</li><li><code>fileTypeRegistrationError</code> - An attempt was made to add a file link to the Jump List for a file type the app isn't registered to handle.</li><li><code>customCategoryAccessDeniedError</code> - Custom categories can't be added to the Jump List due to user privacy or group policy settings.</li></ul><p>If <code>categories</code> is <code>null</code> the previously set custom Jump List (if any) will be replaced by the standard Jump List for the app (managed by Windows).</p><p><strong>Note:</strong> If a <code>JumpListCategory</code> object has neither the <code>type</code> nor the <code>name</code> property set then its <code>type</code> is assumed to be <code>tasks</code>. If the <code>name</code> property is set but the <code>type</code> property is omitted then the <code>type</code> is assumed to be <code>custom</code>.</p><p><strong>Note:</strong> Users can remove items from custom categories, and Windows will not allow a removed item to be added back into a custom category until <strong>after</strong> the next successful call to <code>app.setJumpList(categories)</code>. 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 <code>app.getJumpListSettings()</code>.</p><p><strong>Note:</strong> The maximum length of a Jump List item's <code>description</code> property is 260 characters. Beyond this limit, the item will not be added to the Jump List, nor will it be displayed.</p><p>Here's a very simple example of creating a custom Jump List:</p><div class="codeBlockContainer_K1bP"><div class="codeBlockContent_hGly javascript"><pre tabindex="0" class="prism-code language-javascript codeBlock_23N8 thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_39YC"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> app </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">require</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'electron'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">app</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">setJumpList</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">[</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> type</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'custom'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> name</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'Recent Projects'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> items</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> type</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'file'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> path</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'C:\\Projects\\project1.proj'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> type</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'file'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> path</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'C:\\Projects\\project2.proj'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">]</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// has a name so `type` is assumed to be "custom"</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> name</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'Tools'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> items</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> type</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'task'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> title</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'Tool A'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> program</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> process</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">execPath</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> args</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'--run-tool-a'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> icon</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> process</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">execPath</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> iconIndex</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> description</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'Runs Tool A'</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> type</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'task'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> title</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'Tool B'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> program</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> process</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">execPath</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> args</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'--run-tool-b'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> icon</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> process</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">execPath</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> iconIndex</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> description</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'Runs Tool B'</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">]</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> type</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'frequent'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// has no name and no type so `type` is assumed to be "tasks"</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> items</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> type</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'task'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> title</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'New Project'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> program</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> process</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">execPath</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> args</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'--new-project'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> description</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'Create a new project.'</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> type</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'separator'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> type</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'task'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> title</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'Recover Project'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> program</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> process</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">execPath</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> args</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'--recover-project'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> description</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'Recover Project'</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">]</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><br></span></code></pre><button type="button" aria-label="Copy code to clipboard" class="copyButton_Ue-o clean-btn">Copy</button></div></div><h3 class="anchor anchorWithStickyNavbar_31ik" id="apprequestsingleinstancelock"><code>app.requestSingleInstanceLock()</code><a aria-hidden="true" class="hash-link" href="#apprequestsingleinstancelock" title="Direct link to heading"></a></h3><ul><li><code>additionalData</code> unknown (optional) - A JSON object containing additional data to send to the first instance.</li></ul><p>Returns <code>Boolean</code></p><p>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.</p><p>I.e. This method returns <code>true</code> if your process is the primary instance of your application and your app should continue loading. It returns <code>false</code> if your process should immediately quit as it has sent its parameters to another instance that has already acquired the lock.</p><p>On macOS, the system enforces single instance automatically when users try to open a second instance of your app in Finder, and the <code>open-file</code> and <code>open-url</code> 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.</p><p>An example of activating the window of primary instance when a second instance starts:</p><div class="codeBlockContainer_K1bP"><div class="codeBlockContent_hGly javascript"><pre tabindex="0" class="prism-code language-javascript codeBlock_23N8 thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_39YC"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> app </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">require</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'electron'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> myWindow </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword null nil" style="color:#00009f">null</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> additionalData </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> myKey</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'myValue'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> gotTheLock </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> app</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">requestSingleInstanceLock</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">additionalData</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">if</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">!</span><span class="token plain">gotTheLock</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> app</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">quit</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">else</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> app</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">on</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'second-instance'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter">event</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> commandLine</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> workingDirectory</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> additionalData</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Print out data received from the second instance.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">additionalData</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Someone tried to run a second instance, we should focus our window.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">if</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">myWindow</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">if</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">myWindow</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">isMinimized</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> myWindow</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">restore</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> myWindow</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">focus</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Create myWindow, load the rest of the app, etc...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> app</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">whenReady</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">then</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> myWindow </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">createWindow</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><button type="button" aria-label="Copy code to clipboard" class="copyButton_Ue-o clean-btn">Copy</button></div></div><h3 class="anchor anchorWithStickyNavbar_31ik" id="apphassingleinstancelock"><code>app.hasSingleInstanceLock()</code><a aria-hidden="true" class="hash-link" href="#apphassingleinstancelock" title="Direct link to heading"></a></h3><p>Returns <code>Boolean</code></p><p>This method returns whether or not this instance of your app is currently holding the single instance lock. You can request the lock with <code>app.requestSingleInstanceLock()</code> and release with <code>app.releaseSingleInstanceLock()</code></p><h3 class="anchor anchorWithStickyNavbar_31ik" id="appreleasesingleinstancelock"><code>app.releaseSingleInstanceLock()</code><a aria-hidden="true" class="hash-link" href="#appreleasesingleinstancelock" title="Direct link to heading"></a></h3><p>Releases all locks that were created by <code>requestSingleInstanceLock</code>. This will allow multiple instances of the application to once again run side by side.</p><h3 class="anchor anchorWithStickyNavbar_31ik" id="appsetuseractivitytype-userinfo-webpageurl-macos"><code>app.setUserActivity(type, userInfo[, webpageURL])</code> <em class="badge badge--primary">macOS</em><a aria-hidden="true" class="hash-link" href="#appsetuseractivitytype-userinfo-webpageurl-macos" title="Direct link to heading"></a></h3><ul><li><code>type</code> String - Uniquely identifies the activity. Maps to <a href="https://web.archive.org/web/20211123055155/https://developer.apple.com/library/ios/documentation/Foundation/Reference/NSUserActivity_Class/index.html#//apple_ref/occ/instp/NSUserActivity/activityType" target="_blank" rel="noopener noreferrer"><code>NSUserActivity.activityType</code></a>.</li><li><code>userInfo</code> any - App-specific state to store for use by another device.</li><li><code>webpageURL</code> String (optional) - The webpage to load in a browser if no suitable app is installed on the resuming device. The scheme must be <code>http</code> or <code>https</code>.</li></ul><p>Creates an <code>NSUserActivity</code> and sets it as the current activity. The activity is eligible for <a href="https://web.archive.org/web/20211123055155/https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/Handoff/HandoffFundamentals/HandoffFundamentals.html" target="_blank" rel="noopener noreferrer">Handoff</a> to another device afterward.</p><h3 class="anchor anchorWithStickyNavbar_31ik" id="appgetcurrentactivitytype-macos"><code>app.getCurrentActivityType()</code> <em class="badge badge--primary">macOS</em><a aria-hidden="true" class="hash-link" href="#appgetcurrentactivitytype-macos" title="Direct link to heading"></a></h3><p>Returns <code>String</code> - The type of the currently running activity.</p><h3 class="anchor anchorWithStickyNavbar_31ik" id="appinvalidatecurrentactivity-macos"><code>app.invalidateCurrentActivity()</code> <em class="badge badge--primary">macOS</em><a aria-hidden="true" class="hash-link" href="#appinvalidatecurrentactivity-macos" title="Direct link to heading"></a></h3><p>Invalidates the current <a href="https://web.archive.org/web/20211123055155/https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/Handoff/HandoffFundamentals/HandoffFundamentals.html" target="_blank" rel="noopener noreferrer">Handoff</a> user activity.</p><h3 class="anchor anchorWithStickyNavbar_31ik" id="appresigncurrentactivity-macos"><code>app.resignCurrentActivity()</code> <em class="badge badge--primary">macOS</em><a aria-hidden="true" class="hash-link" href="#appresigncurrentactivity-macos" title="Direct link to heading"></a></h3><p>Marks the current <a href="https://web.archive.org/web/20211123055155/https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/Handoff/HandoffFundamentals/HandoffFundamentals.html" target="_blank" rel="noopener noreferrer">Handoff</a> user activity as inactive without invalidating it.</p><h3 class="anchor anchorWithStickyNavbar_31ik" id="appupdatecurrentactivitytype-userinfo-macos"><code>app.updateCurrentActivity(type, userInfo)</code> <em class="badge badge--primary">macOS</em><a aria-hidden="true" class="hash-link" href="#appupdatecurrentactivitytype-userinfo-macos" title="Direct link to heading"></a></h3><ul><li><code>type</code> String - Uniquely identifies the activity. Maps to <a href="https://web.archive.org/web/20211123055155/https://developer.apple.com/library/ios/documentation/Foundation/Reference/NSUserActivity_Class/index.html#//apple_ref/occ/instp/NSUserActivity/activityType" target="_blank" rel="noopener noreferrer"><code>NSUserActivity.activityType</code></a>.</li><li><code>userInfo</code> any - App-specific state to store for use by another device.</li></ul><p>Updates the current activity if its type matches <code>type</code>, merging the entries from <code>userInfo</code> into its current <code>userInfo</code> dictionary.</p><h3 class="anchor anchorWithStickyNavbar_31ik" id="appsetappusermodelidid-windows"><code>app.setAppUserModelId(id)</code> <em class="badge badge--primary">Windows</em><a aria-hidden="true" class="hash-link" href="#appsetappusermodelidid-windows" title="Direct link to heading"></a></h3><ul><li><code>id</code> String</li></ul><p>Changes the <a href="https://web.archive.org/web/20211123055155/https://msdn.microsoft.com/en-us/library/windows/desktop/dd378459(v=vs.85).aspx" target="_blank" rel="noopener noreferrer">Application User Model ID</a> to <code>id</code>.</p><h3 class="anchor anchorWithStickyNavbar_31ik" id="appsetactivationpolicypolicy-macos"><code>app.setActivationPolicy(policy)</code> <em class="badge badge--primary">macOS</em><a aria-hidden="true" class="hash-link" href="#appsetactivationpolicypolicy-macos" title="Direct link to heading"></a></h3><ul><li><code>policy</code> String - Can be 'regular', 'accessory', or 'prohibited'.</li></ul><p>Sets the activation policy for a given app.</p><p>Activation policy types:</p><ul><li>'regular' - The application is an ordinary app that appears in the Dock and may have a user interface.</li><li>'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.</li><li>'prohibited' - The application doesn’t appear in the Dock and may not create windows or be activated.</li></ul><h3 class="anchor anchorWithStickyNavbar_31ik" id="appimportcertificateoptions-callback-linux"><code>app.importCertificate(options, callback)</code> <em class="badge badge--primary">Linux</em><a aria-hidden="true" class="hash-link" href="#appimportcertificateoptions-callback-linux" title="Direct link to heading"></a></h3><ul><li><code>options</code> Object<ul><li><code>certificate</code> String - Path for the pkcs12 file.</li><li><code>password</code> String - Passphrase for the certificate.</li></ul></li><li><code>callback</code> Function<ul><li><code>result</code> Integer - Result of import.</li></ul></li></ul><p>Imports the certificate in pkcs12 format into the platform certificate store. <code>callback</code> is called with the <code>result</code> of import operation, a value of <code>0</code> indicates success while any other value indicates failure according to Chromium <a href="https://web.archive.org/web/20211123055155/https://source.chromium.org/chromium/chromium/src/+/master:net/base/net_error_list.h" target="_blank" rel="noopener noreferrer">net_error_list</a>.</p><h3 class="anchor anchorWithStickyNavbar_31ik" id="appconfigurehostresolveroptions"><code>app.configureHostResolver(options)</code><a aria-hidden="true" class="hash-link" href="#appconfigurehostresolveroptions" title="Direct link to heading"></a></h3><ul><li><code>options</code> Object<ul><li><code>enableBuiltInResolver</code> Boolean (optional) - 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.</li><li><code>secureDnsMode</code> String (optional) - 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".</li><li><code>secureDnsServers</code> String[]<!-- --> <!-- -->(optional) - A list of DNS-over-HTTP server templates. See <a href="https://web.archive.org/web/20211123055155/https://datatracker.ietf.org/doc/html/rfc8484#section-3" target="_blank" rel="noopener noreferrer">RFC8484 § 3</a> for details on the template format. Most servers support the POST method; the template for such servers is simply a URI. Note that for <a href="https://web.archive.org/web/20211123055155/https://source.chromium.org/chromium/chromium/src/+/main:net/dns/public/doh_provider_entry.cc;l=31?q=%22DohProviderEntry::GetList()%22&ss=chromium%2Fchromium%2Fsrc" target="_blank" rel="noopener noreferrer">some DNS providers</a>, the resolver will automatically upgrade to DoH unless DoH is explicitly disabled, even if there are no DoH servers provided in this list.</li><li><code>enableAdditionalDnsQueryTypes</code> Boolean (optional) - 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.</li></ul></li></ul><p>Configures host resolution (DNS and DNS-over-HTTPS). By default, the following resolvers will be used, in order:</p><ol><li>DNS-over-HTTPS, if the <a href="https://web.archive.org/web/20211123055155/https://source.chromium.org/chromium/chromium/src/+/main:net/dns/public/doh_provider_entry.cc;l=31?q=%22DohProviderEntry::GetList()%22&ss=chromium%2Fchromium%2Fsrc" target="_blank" rel="noopener noreferrer">DNS provider supports it</a>, then</li><li>the built-in resolver (enabled on macOS only by default), then</li><li>the system's resolver (e.g. <code>getaddrinfo</code>).</li></ol><p>This can be configured to either restrict usage of non-encrypted DNS (<code>secureDnsMode: "secure"</code>), or disable DNS-over-HTTPS (<code>secureDnsMode: "off"</code>). It is also possible to enable or disable the built-in resolver.</p><p>To disable insecure DNS, you can specify a <code>secureDnsMode</code> of <code>"secure"</code>. 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.</p><div class="codeBlockContainer_K1bP"><div class="codeBlockContent_hGly js"><pre tabindex="0" class="prism-code language-js codeBlock_23N8 thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_39YC"><span class="token-line" style="color:#393A34"><span class="token plain">app</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">configureHostResolver</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> secureDnsMode</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'secure'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> secureDnsServers</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token string" style="color:#e3116c">'https://cloudflare-dns.com/dns-query'</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">]</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><br></span></code></pre><button type="button" aria-label="Copy code to clipboard" class="copyButton_Ue-o clean-btn">Copy</button></div></div><p>This API must be called after the <code>ready</code> event is emitted.</p><h3 class="anchor anchorWithStickyNavbar_31ik" id="appdisablehardwareacceleration"><code>app.disableHardwareAcceleration()</code><a aria-hidden="true" class="hash-link" href="#appdisablehardwareacceleration" title="Direct link to heading"></a></h3><p>Disables hardware acceleration for current app.</p><p>This method can only be called before app is ready.</p><h3 class="anchor anchorWithStickyNavbar_31ik" id="appdisabledomainblockingfor3dapis"><code>app.disableDomainBlockingFor3DAPIs()</code><a aria-hidden="true" class="hash-link" href="#appdisabledomainblockingfor3dapis" title="Direct link to heading"></a></h3><p>By default, Chromium disables 3D APIs (e.g. WebGL) until restart on a per domain basis if the GPU processes crashes too frequently. This function disables that behavior.</p><p>This method can only be called before app is ready.</p><h3 class="anchor anchorWithStickyNavbar_31ik" id="appgetappmetrics"><code>app.getAppMetrics()</code><a aria-hidden="true" class="hash-link" href="#appgetappmetrics" title="Direct link to heading"></a></h3><p>Returns <a aria-describedby="structures-tooltip" href="/web/20211123055155/https://www.electronjs.org/docs/latest/api/structures/process-metric" class="link_2NU_">ProcessMetric[]</a>: Array of <code>ProcessMetric</code> objects that correspond to memory and CPU usage statistics of all the processes associated with the app.</p><h3 class="anchor anchorWithStickyNavbar_31ik" id="appgetgpufeaturestatus"><code>app.getGPUFeatureStatus()</code><a aria-hidden="true" class="hash-link" href="#appgetgpufeaturestatus" title="Direct link to heading"></a></h3><p>Returns <a aria-describedby="structures-tooltip" href="/web/20211123055155/https://www.electronjs.org/docs/latest/api/structures/gpu-feature-status" class="link_2NU_">GPUFeatureStatus</a> - The Graphics Feature Status from <code>chrome://gpu/</code>.</p><p><strong>Note:</strong> This information is only usable after the <code>gpu-info-update</code> event is emitted.</p><h3 class="anchor anchorWithStickyNavbar_31ik" id="appgetgpuinfoinfotype"><code>app.getGPUInfo(infoType)</code><a aria-hidden="true" class="hash-link" href="#appgetgpuinfoinfotype" title="Direct link to heading"></a></h3><ul><li><code>infoType</code> String - Can be <code>basic</code> or <code>complete</code>.</li></ul><p>Returns <code>Promise<unknown></code></p><p>For <code>infoType</code> equal to <code>complete</code>: Promise is fulfilled with <code>Object</code> containing all the GPU Information as in <a href="https://web.archive.org/web/20211123055155/https://chromium.googlesource.com/chromium/src/+/4178e190e9da409b055e5dff469911ec6f6b716f/gpu/config/gpu_info.cc" target="_blank" rel="noopener noreferrer">chromium's GPUInfo object</a>. This includes the version and driver information that's shown on <code>chrome://gpu</code> page.</p><p>For <code>infoType</code> equal to <code>basic</code>: Promise is fulfilled with <code>Object</code> containing fewer attributes than when requested with <code>complete</code>. Here's an example of basic response:</p><div class="codeBlockContainer_K1bP"><div class="codeBlockContent_hGly js"><pre tabindex="0" class="prism-code language-js codeBlock_23N8 thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_39YC"><span class="token-line" style="color:#393A34"><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> auxAttributes</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> amdSwitchable</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> canSupportThreadedTextureMailbox</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">false</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> directComposition</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">false</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> directRendering</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> glResetNotificationStrategy</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> inProcessGpu</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> initializationTime</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> jpegDecodeAcceleratorSupported</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">false</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> optimus</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">false</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> passthroughCmdDecoder</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">false</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> sandboxed</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">false</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> softwareRendering</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">false</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> supportsOverlays</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">false</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> videoDecodeAcceleratorFlags</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> gpuDevice</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> active</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> deviceId</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">26657</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> vendorId</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">4098</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> active</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">false</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> deviceId</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">3366</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> vendorId</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">32902</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> machineModelName</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'MacBookPro'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> machineModelVersion</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'11.5'</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><button type="button" aria-label="Copy code to clipboard" class="copyButton_Ue-o clean-btn">Copy</button></div></div><p>Using <code>basic</code> should be preferred if only basic information like <code>vendorId</code> or <code>driverId</code> is needed.</p><h3 class="anchor anchorWithStickyNavbar_31ik" id="appsetbadgecountcount-linux-macos"><code>app.setBadgeCount([count])</code> <em class="badge badge--primary">Linux</em> <em class="badge badge--primary">macOS</em><a aria-hidden="true" class="hash-link" href="#appsetbadgecountcount-linux-macos" title="Direct link to heading"></a></h3><ul><li><code>count</code> Integer (optional) - If a value is provided, set the badge to the provided value otherwise, on macOS, display a plain white dot (e.g. unknown number of notifications). On Linux, if a value is not provided the badge will not display.</li></ul><p>Returns <code>Boolean</code> - Whether the call succeeded.</p><p>Sets the counter badge for current app. Setting the count to <code>0</code> will hide the badge.</p><p>On macOS, it shows on the dock icon. On Linux, it only works for Unity launcher.</p><p><strong>Note:</strong> Unity launcher requires a <code>.desktop</code> file to work. For more information, please read the <a href="https://web.archive.org/web/20211123055155/https://help.ubuntu.com/community/UnityLaunchersAndDesktopFiles#Adding_shortcuts_to_a_launcher" target="_blank" rel="noopener noreferrer">Unity integration documentation</a>.</p><h3 class="anchor anchorWithStickyNavbar_31ik" id="appgetbadgecount-linux-macos"><code>app.getBadgeCount()</code> <em class="badge badge--primary">Linux</em> <em class="badge badge--primary">macOS</em><a aria-hidden="true" class="hash-link" href="#appgetbadgecount-linux-macos" title="Direct link to heading"></a></h3><p>Returns <code>Integer</code> - The current value displayed in the counter badge.</p><h3 class="anchor anchorWithStickyNavbar_31ik" id="appisunityrunning-linux"><code>app.isUnityRunning()</code> <em class="badge badge--primary">Linux</em><a aria-hidden="true" class="hash-link" href="#appisunityrunning-linux" title="Direct link to heading"></a></h3><p>Returns <code>Boolean</code> - Whether the current desktop environment is Unity launcher.</p><h3 class="anchor anchorWithStickyNavbar_31ik" id="appgetloginitemsettingsoptions-macos-windows"><code>app.getLoginItemSettings([options])</code> <em class="badge badge--primary">macOS</em> <em class="badge badge--primary">Windows</em><a aria-hidden="true" class="hash-link" href="#appgetloginitemsettingsoptions-macos-windows" title="Direct link to heading"></a></h3><ul><li><code>options</code> Object (optional)<ul><li><code>path</code> String (optional) <em class="badge badge--primary">Windows</em> - The executable path to compare against. Defaults to <code>process.execPath</code>.</li><li><code>args</code> String[] (optional) <em class="badge badge--primary">Windows</em> - The command-line arguments to compare against. Defaults to an empty array.</li></ul></li></ul><p>If you provided <code>path</code> and <code>args</code> options to <code>app.setLoginItemSettings</code>, then you need to pass the same arguments here for <code>openAtLogin</code> to be set correctly.</p><p>Returns <code>Object</code>:</p><ul><li><code>openAtLogin</code> Boolean - <code>true</code> if the app is set to open at login.</li><li><code>openAsHidden</code> Boolean <em class="badge badge--primary">macOS</em> - <code>true</code> if the app is set to open as hidden at login. This setting is not available on <a href="/web/20211123055155/https://www.electronjs.org/docs/latest/tutorial/mac-app-store-submission-guide">MAS builds</a>.</li><li><code>wasOpenedAtLogin</code> Boolean <em class="badge badge--primary">macOS</em> - <code>true</code> if the app was opened at login automatically. This setting is not available on <a href="/web/20211123055155/https://www.electronjs.org/docs/latest/tutorial/mac-app-store-submission-guide">MAS builds</a>.</li><li><code>wasOpenedAsHidden</code> Boolean <em class="badge badge--primary">macOS</em> - <code>true</code> if the app was opened as a hidden login item. This indicates that the app should not open any windows at startup. This setting is not available on <a href="/web/20211123055155/https://www.electronjs.org/docs/latest/tutorial/mac-app-store-submission-guide">MAS builds</a>.</li><li><code>restoreState</code> Boolean <em class="badge badge--primary">macOS</em> - <code>true</code> if the app was opened as a login item that should restore the state from the previous session. This indicates that the app should restore the windows that were open the last time the app was closed. This setting is not available on <a href="/web/20211123055155/https://www.electronjs.org/docs/latest/tutorial/mac-app-store-submission-guide">MAS builds</a>.</li><li><code>executableWillLaunchAtLogin</code> Boolean <em class="badge badge--primary">Windows</em> - <code>true</code> if app is set to open at login and its run key is not deactivated. This differs from <code>openAtLogin</code> as it ignores the <code>args</code> option, this property will be true if the given executable would be launched at login with <strong>any</strong> arguments.</li><li><code>launchItems</code> Object[] <em class="badge badge--primary">Windows</em><ul><li><code>name</code> String <em class="badge badge--primary">Windows</em> - name value of a registry entry.</li><li><code>path</code> String <em class="badge badge--primary">Windows</em> - The executable to an app that corresponds to a registry entry.</li><li><code>args</code> String[] <em class="badge badge--primary">Windows</em> - the command-line arguments to pass to the executable.</li><li><code>scope</code> String <em class="badge badge--primary">Windows</em> - one of <code>user</code> or <code>machine</code>. Indicates whether the registry entry is under <code>HKEY_CURRENT USER</code> or <code>HKEY_LOCAL_MACHINE</code>.</li><li><code>enabled</code> Boolean <em class="badge badge--primary">Windows</em> - <code>true</code> if the app registry key is startup approved and therefore shows as <code>enabled</code> in Task Manager and Windows settings.</li></ul></li></ul><h3 class="anchor anchorWithStickyNavbar_31ik" id="appsetloginitemsettingssettings-macos-windows"><code>app.setLoginItemSettings(settings)</code> <em class="badge badge--primary">macOS</em> <em class="badge badge--primary">Windows</em><a aria-hidden="true" class="hash-link" href="#appsetloginitemsettingssettings-macos-windows" title="Direct link to heading"></a></h3><ul><li><code>settings</code> Object<ul><li><code>openAtLogin</code> Boolean (optional) - <code>true</code> to open the app at login, <code>false</code> to remove the app as a login item. Defaults to <code>false</code>.</li><li><code>openAsHidden</code> Boolean (optional) <em class="badge badge--primary">macOS</em> - <code>true</code> to open the app as hidden. Defaults to <code>false</code>. The user can edit this setting from the System Preferences so <code>app.getLoginItemSettings().wasOpenedAsHidden</code> should be checked when the app is opened to know the current value. This setting is not available on <a href="/web/20211123055155/https://www.electronjs.org/docs/latest/tutorial/mac-app-store-submission-guide">MAS builds</a>.</li><li><code>path</code> String (optional) <em class="badge badge--primary">Windows</em> - The executable to launch at login. Defaults to <code>process.execPath</code>.</li><li><code>args</code> String[] (optional) <em class="badge badge--primary">Windows</em> - The command-line arguments to pass to the executable. Defaults to an empty array. Take care to wrap paths in quotes.</li><li><code>enabled</code> Boolean (optional) <em class="badge badge--primary">Windows</em> - <code>true</code> will change the startup approved registry key and <code>enable / disable</code> the App in Task Manager and Windows Settings. Defaults to <code>true</code>.</li><li><code>name</code> String (optional) <em class="badge badge--primary">Windows</em> - value name to write into registry. Defaults to the app's AppUserModelId(). Set the app's login item settings.</li></ul></li></ul><p>To work with Electron's <code>autoUpdater</code> on Windows, which uses <a href="https://web.archive.org/web/20211123055155/https://github.com/Squirrel/Squirrel.Windows" target="_blank" rel="noopener noreferrer">Squirrel</a>, you'll want to set the launch path to Update.exe, and pass arguments that specify your application name. For example:</p><div class="codeBlockContainer_K1bP"><div class="codeBlockContent_hGly javascript"><pre tabindex="0" class="prism-code language-javascript codeBlock_23N8 thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_39YC"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> appFolder </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> path</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">dirname</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">process</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">execPath</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> updateExe </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> path</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">resolve</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">appFolder</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'..'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'Update.exe'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> exeName </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> path</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">basename</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">process</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">execPath</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">app</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">setLoginItemSettings</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> openAtLogin</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> path</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> updateExe</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> args</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token string" style="color:#e3116c">'--processStart'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string string" style="color:#e3116c">"</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">exeName</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string string" style="color:#e3116c">"</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token string" style="color:#e3116c">'--process-start-args'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string string" style="color:#e3116c">"--hidden"</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">]</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><br></span></code></pre><button type="button" aria-label="Copy code to clipboard" class="copyButton_Ue-o clean-btn">Copy</button></div></div><h3 class="anchor anchorWithStickyNavbar_31ik" id="appisaccessibilitysupportenabled-macos-windows"><code>app.isAccessibilitySupportEnabled()</code> <em class="badge badge--primary">macOS</em> <em class="badge badge--primary">Windows</em><a aria-hidden="true" class="hash-link" href="#appisaccessibilitysupportenabled-macos-windows" title="Direct link to heading"></a></h3><p>Returns <code>Boolean</code> - <code>true</code> if Chrome's accessibility support is enabled, <code>false</code> otherwise. This API will return <code>true</code> if the use of assistive technologies, such as screen readers, has been detected. See <a href="https://web.archive.org/web/20211123055155/https://www.chromium.org/developers/design-documents/accessibility" target="_blank" rel="noopener noreferrer">https://www.chromium.org/developers/design-documents/accessibility</a> for more details.</p><h3 class="anchor anchorWithStickyNavbar_31ik" id="appsetaccessibilitysupportenabledenabled-macos-windows"><code>app.setAccessibilitySupportEnabled(enabled)</code> <em class="badge badge--primary">macOS</em> <em class="badge badge--primary">Windows</em><a aria-hidden="true" class="hash-link" href="#appsetaccessibilitysupportenabledenabled-macos-windows" title="Direct link to heading"></a></h3><ul><li><code>enabled</code> Boolean - Enable or disable <a href="https://web.archive.org/web/20211123055155/https://developers.google.com/web/fundamentals/accessibility/semantics-builtin/the-accessibility-tree" target="_blank" rel="noopener noreferrer">accessibility tree</a> rendering</li></ul><p>Manually enables Chrome's accessibility support, allowing to expose accessibility switch to users in application settings. See <a href="https://web.archive.org/web/20211123055155/https://www.chromium.org/developers/design-documents/accessibility" target="_blank" rel="noopener noreferrer">Chromium's accessibility docs</a> for more details. Disabled by default.</p><p>This API must be called after the <code>ready</code> event is emitted.</p><p><strong>Note:</strong> Rendering accessibility tree can significantly affect the performance of your app. It should not be enabled by default.</p><h3 class="anchor anchorWithStickyNavbar_31ik" id="appshowaboutpanel"><code>app.showAboutPanel()</code><a aria-hidden="true" class="hash-link" href="#appshowaboutpanel" title="Direct link to heading"></a></h3><p>Show the app's about panel options. These options can be overridden with <code>app.setAboutPanelOptions(options)</code>.</p><h3 class="anchor anchorWithStickyNavbar_31ik" id="appsetaboutpaneloptionsoptions"><code>app.setAboutPanelOptions(options)</code><a aria-hidden="true" class="hash-link" href="#appsetaboutpaneloptionsoptions" title="Direct link to heading"></a></h3><ul><li><code>options</code> Object<ul><li><code>applicationName</code> String (optional) - The app's name.</li><li><code>applicationVersion</code> String (optional) - The app's version.</li><li><code>copyright</code> String (optional) - Copyright information.</li><li><code>version</code> String (optional) <em class="badge badge--primary">macOS</em> - The app's build version number.</li><li><code>credits</code> String (optional) <em class="badge badge--primary">macOS</em> <em class="badge badge--primary">Windows</em> - Credit information.</li><li><code>authors</code> String[] (optional) <em class="badge badge--primary">Linux</em> - List of app authors.</li><li><code>website</code> String (optional) <em class="badge badge--primary">Linux</em> - The app's website.</li><li><code>iconPath</code> String (optional) <em class="badge badge--primary">Linux</em> <em class="badge badge--primary">Windows</em> - Path to the app's icon in a JPEG or PNG file format. On Linux, will be shown as 64x64 pixels while retaining aspect ratio.</li></ul></li></ul><p>Set the about panel options. This will override the values defined in the app's <code>.plist</code> file on macOS. See the <a href="https://web.archive.org/web/20211123055155/https://developer.apple.com/reference/appkit/nsapplication/1428479-orderfrontstandardaboutpanelwith?language=objc" target="_blank" rel="noopener noreferrer">Apple docs</a> for more details. On Linux, values must be set in order to be shown; there are no defaults.</p><p>If you do not set <code>credits</code> but still wish to surface them in your app, AppKit will look for a file named "Credits.html", "Credits.rtf", and "Credits.rtfd", in that order, in the bundle returned by the NSBundle class method main. The first file found is used, and if none is found, the info area is left blank. See Apple <a href="https://web.archive.org/web/20211123055155/https://developer.apple.com/documentation/appkit/nsaboutpaneloptioncredits?language=objc" target="_blank" rel="noopener noreferrer">documentation</a> for more information.</p><h3 class="anchor anchorWithStickyNavbar_31ik" id="appisemojipanelsupported"><code>app.isEmojiPanelSupported()</code><a aria-hidden="true" class="hash-link" href="#appisemojipanelsupported" title="Direct link to heading"></a></h3><p>Returns <code>Boolean</code> - whether or not the current OS version allows for native emoji pickers.</p><h3 class="anchor anchorWithStickyNavbar_31ik" id="appshowemojipanel-macos-windows"><code>app.showEmojiPanel()</code> <em class="badge badge--primary">macOS</em> <em class="badge badge--primary">Windows</em><a aria-hidden="true" class="hash-link" href="#appshowemojipanel-macos-windows" title="Direct link to heading"></a></h3><p>Show the platform's native emoji picker.</p><h3 class="anchor anchorWithStickyNavbar_31ik" id="appstartaccessingsecurityscopedresourcebookmarkdata-mas"><code>app.startAccessingSecurityScopedResource(bookmarkData)</code> <em>mas</em><a aria-hidden="true" class="hash-link" href="#appstartaccessingsecurityscopedresourcebookmarkdata-mas" title="Direct link to heading"></a></h3><ul><li><code>bookmarkData</code> String - The base64 encoded security scoped bookmark data returned by the <code>dialog.showOpenDialog</code> or <code>dialog.showSaveDialog</code> methods.</li></ul><p>Returns <code>Function</code> - This function <strong>must</strong> be called once you have finished accessing the security scoped file. If you do not remember to stop accessing the bookmark, <a href="https://web.archive.org/web/20211123055155/https://developer.apple.com/reference/foundation/nsurl/1417051-startaccessingsecurityscopedreso?language=objc" target="_blank" rel="noopener noreferrer">kernel resources will be leaked</a> and your app will lose its ability to reach outside the sandbox completely, until your app is restarted.</p><div class="codeBlockContainer_K1bP"><div class="codeBlockContent_hGly js"><pre tabindex="0" class="prism-code language-js codeBlock_23N8 thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_39YC"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">// Start accessing the file.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> stopAccessingSecurityScopedResource </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> app</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">startAccessingSecurityScopedResource</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">data</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// You can now access the file outside of the sandbox 🎉</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Remember to stop accessing the file once you've finished with it.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token function" style="color:#d73a49">stopAccessingSecurityScopedResource</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><br></span></code></pre><button type="button" aria-label="Copy code to clipboard" class="copyButton_Ue-o clean-btn">Copy</button></div></div><p>Start accessing a security scoped resource. With this method Electron applications that are packaged for the Mac App Store may reach outside their sandbox to access files chosen by the user. See <a href="https://web.archive.org/web/20211123055155/https://developer.apple.com/library/content/documentation/Security/Conceptual/AppSandboxDesignGuide/AppSandboxInDepth/AppSandboxInDepth.html#//apple_ref/doc/uid/TP40011183-CH3-SW16" target="_blank" rel="noopener noreferrer">Apple's documentation</a> for a description of how this system works.</p><h3 class="anchor anchorWithStickyNavbar_31ik" id="appenablesandbox"><code>app.enableSandbox()</code><a aria-hidden="true" class="hash-link" href="#appenablesandbox" title="Direct link to heading"></a></h3><p>Enables full sandbox mode on the app. This means that all renderers will be launched sandboxed, regardless of the value of the <code>sandbox</code> flag in WebPreferences.</p><p>This method can only be called before app is ready.</p><h3 class="anchor anchorWithStickyNavbar_31ik" id="appisinapplicationsfolder-macos"><code>app.isInApplicationsFolder()</code> <em class="badge badge--primary">macOS</em><a aria-hidden="true" class="hash-link" href="#appisinapplicationsfolder-macos" title="Direct link to heading"></a></h3><p>Returns <code>Boolean</code> - Whether the application is currently running from the systems Application folder. Use in combination with <code>app.moveToApplicationsFolder()</code></p><h3 class="anchor anchorWithStickyNavbar_31ik" id="appmovetoapplicationsfolderoptions-macos"><code>app.moveToApplicationsFolder([options])</code> <em class="badge badge--primary">macOS</em><a aria-hidden="true" class="hash-link" href="#appmovetoapplicationsfolderoptions-macos" title="Direct link to heading"></a></h3><ul><li><code>options</code> Object (optional)<ul><li><code>conflictHandler</code> Function\<Boolean<!-- -->><!-- --> (optional) - A handler for potential conflict in move failure.<ul><li><code>conflictType</code> String - The type of move conflict encountered by the handler; can be <code>exists</code> or <code>existsAndRunning</code>, where <code>exists</code> means that an app of the same name is present in the Applications directory and <code>existsAndRunning</code> means both that it exists and that it's presently running.</li></ul></li></ul></li></ul><p>Returns <code>Boolean</code> - Whether the move was successful. Please note that if the move is successful, your application will quit and relaunch.</p><p>No confirmation dialog will be presented by default. If you wish to allow the user to confirm the operation, you may do so using the <a href="/web/20211123055155/https://www.electronjs.org/docs/latest/api/dialog"><code>dialog</code></a> API.</p><p><strong>NOTE:</strong> This method throws errors if anything other than the user causes the move to fail. For instance if the user cancels the authorization dialog, this method returns false. If we fail to perform the copy, then this method will throw an error. The message in the error should be informative and tell you exactly what went wrong.</p><p>By default, if an app of the same name as the one being moved exists in the Applications directory and is <em>not</em> running, the existing app will be trashed and the active app moved into its place. If it <em>is</em> running, the pre-existing running app will assume focus and the previously active app will quit itself. This behavior can be changed by providing the optional conflict handler, where the boolean returned by the handler determines whether or not the move conflict is resolved with default behavior. i.e. returning <code>false</code> will ensure no further action is taken, returning <code>true</code> will result in the default behavior and the method continuing.</p><p>For example:</p><div class="codeBlockContainer_K1bP"><div class="codeBlockContent_hGly js"><pre tabindex="0" class="prism-code language-js codeBlock_23N8 thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_39YC"><span class="token-line" style="color:#393A34"><span class="token plain">app</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">moveToApplicationsFolder</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function-variable function" style="color:#d73a49">conflictHandler</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter">conflictType</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">if</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">conflictType </span><span class="token operator" style="color:#393A34">===</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'exists'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">return</span><span class="token plain"> dialog</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">showMessageBoxSync</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> type</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'question'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> buttons</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">'Halt Move'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'Continue Move'</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> defaultId</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> message</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'An app of this name already exists'</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">===</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">1</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><br></span></code></pre><button type="button" aria-label="Copy code to clipboard" class="copyButton_Ue-o clean-btn">Copy</button></div></div><p>Would mean that if an app already exists in the user directory, if the user chooses to 'Continue Move' then the function would continue with its default behavior and the existing app will be trashed and the active app moved into its place.</p><h3 class="anchor anchorWithStickyNavbar_31ik" id="appissecurekeyboardentryenabled-macos"><code>app.isSecureKeyboardEntryEnabled()</code> <em class="badge badge--primary">macOS</em><a aria-hidden="true" class="hash-link" href="#appissecurekeyboardentryenabled-macos" title="Direct link to heading"></a></h3><p>Returns <code>Boolean</code> - whether <code>Secure Keyboard Entry</code> is enabled.</p><p>By default this API will return <code>false</code>.</p><h3 class="anchor anchorWithStickyNavbar_31ik" id="appsetsecurekeyboardentryenabledenabled-macos"><code>app.setSecureKeyboardEntryEnabled(enabled)</code> <em class="badge badge--primary">macOS</em><a aria-hidden="true" class="hash-link" href="#appsetsecurekeyboardentryenabledenabled-macos" title="Direct link to heading"></a></h3><ul><li><code>enabled</code> Boolean - Enable or disable <code>Secure Keyboard Entry</code></li></ul><p>Set the <code>Secure Keyboard Entry</code> is enabled in your application.</p><p>By using this API, important information such as password and other sensitive information can be prevented from being intercepted by other processes.</p><p>See <a href="https://web.archive.org/web/20211123055155/https://developer.apple.com/library/archive/technotes/tn2150/_index.html" target="_blank" rel="noopener noreferrer">Apple's documentation</a> for more details.</p><p><strong>Note:</strong> Enable <code>Secure Keyboard Entry</code> only when it is needed and disable it when it is no longer needed.</p><h2 class="anchor anchorWithStickyNavbar_31ik" id="properties">Properties<a aria-hidden="true" class="hash-link" href="#properties" title="Direct link to heading"></a></h2><h3 class="anchor anchorWithStickyNavbar_31ik" id="appaccessibilitysupportenabled-macos-windows"><code>app.accessibilitySupportEnabled</code> <em class="badge badge--primary">macOS</em> <em class="badge badge--primary">Windows</em><a aria-hidden="true" class="hash-link" href="#appaccessibilitysupportenabled-macos-windows" title="Direct link to heading"></a></h3><p>A <code>Boolean</code> property that's <code>true</code> if Chrome's accessibility support is enabled, <code>false</code> otherwise. This property will be <code>true</code> if the use of assistive technologies, such as screen readers, has been detected. Setting this property to <code>true</code> manually enables Chrome's accessibility support, allowing developers to expose accessibility switch to users in application settings.</p><p>See <a href="https://web.archive.org/web/20211123055155/https://www.chromium.org/developers/design-documents/accessibility" target="_blank" rel="noopener noreferrer">Chromium's accessibility docs</a> for more details. Disabled by default.</p><p>This API must be called after the <code>ready</code> event is emitted.</p><p><strong>Note:</strong> Rendering accessibility tree can significantly affect the performance of your app. It should not be enabled by default.</p><h3 class="anchor anchorWithStickyNavbar_31ik" id="appapplicationmenu"><code>app.applicationMenu</code><a aria-hidden="true" class="hash-link" href="#appapplicationmenu" title="Direct link to heading"></a></h3><p>A <code>Menu | null</code> property that returns <a href="/web/20211123055155/https://www.electronjs.org/docs/latest/api/menu"><code>Menu</code></a> if one has been set and <code>null</code> otherwise. Users can pass a <a href="/web/20211123055155/https://www.electronjs.org/docs/latest/api/menu">Menu</a> to set this property.</p><h3 class="anchor anchorWithStickyNavbar_31ik" id="appbadgecount-linux-macos"><code>app.badgeCount</code> <em class="badge badge--primary">Linux</em> <em class="badge badge--primary">macOS</em><a aria-hidden="true" class="hash-link" href="#appbadgecount-linux-macos" title="Direct link to heading"></a></h3><p>An <code>Integer</code> property that returns the badge count for current app. Setting the count to <code>0</code> will hide the badge.</p><p>On macOS, setting this with any nonzero integer shows on the dock icon. On Linux, this property only works for Unity launcher.</p><p><strong>Note:</strong> Unity launcher requires a <code>.desktop</code> file to work. For more information, please read the <a href="https://web.archive.org/web/20211123055155/https://help.ubuntu.com/community/UnityLaunchersAndDesktopFiles#Adding_shortcuts_to_a_launcher" target="_blank" rel="noopener noreferrer">Unity integration documentation</a>.</p><p><strong>Note:</strong> On macOS, you need to ensure that your application has the permission to display notifications for this property to take effect.</p><h3 class="anchor anchorWithStickyNavbar_31ik" id="appcommandline-readonly"><code>app.commandLine</code> <em class="badge badge--info">Readonly</em><a aria-hidden="true" class="hash-link" href="#appcommandline-readonly" title="Direct link to heading"></a></h3><p>A <a href="/web/20211123055155/https://www.electronjs.org/docs/latest/api/command-line"><code>CommandLine</code></a> object that allows you to read and manipulate the command line arguments that Chromium uses.</p><h3 class="anchor anchorWithStickyNavbar_31ik" id="appdock-macos-readonly"><code>app.dock</code> <em class="badge badge--primary">macOS</em> <em class="badge badge--info">Readonly</em><a aria-hidden="true" class="hash-link" href="#appdock-macos-readonly" title="Direct link to heading"></a></h3><p>A <a href="/web/20211123055155/https://www.electronjs.org/docs/latest/api/dock"><code>Dock</code></a> <code>| undefined</code> object that allows you to perform actions on your app icon in the user's dock on macOS.</p><h3 class="anchor anchorWithStickyNavbar_31ik" id="appispackaged-readonly"><code>app.isPackaged</code> <em class="badge badge--info">Readonly</em><a aria-hidden="true" class="hash-link" href="#appispackaged-readonly" title="Direct link to heading"></a></h3><p>A <code>Boolean</code> property that returns <code>true</code> if the app is packaged, <code>false</code> otherwise. For many apps, this property can be used to distinguish development and production environments.</p><h3 class="anchor anchorWithStickyNavbar_31ik" id="appname"><code>app.name</code><a aria-hidden="true" class="hash-link" href="#appname" title="Direct link to heading"></a></h3><p>A <code>String</code> property that indicates the current application's name, which is the name in the application's <code>package.json</code> file.</p><p>Usually the <code>name</code> field of <code>package.json</code> is a short lowercase name, according to the npm modules spec. You should usually also specify a <code>productName</code> field, which is your application's full capitalized name, and which will be preferred over <code>name</code> by Electron.</p><h3 class="anchor anchorWithStickyNavbar_31ik" id="appuseragentfallback"><code>app.userAgentFallback</code><a aria-hidden="true" class="hash-link" href="#appuseragentfallback" title="Direct link to heading"></a></h3><p>A <code>String</code> which is the user agent string Electron will use as a global fallback.</p><p>This is the user agent that will be used when no user agent is set at the <code>webContents</code> or <code>session</code> level. It is useful for ensuring that your entire app has the same user agent. Set to a custom value as early as possible in your app's initialization to ensure that your overridden value is used.</p><h3 class="anchor anchorWithStickyNavbar_31ik" id="apprunningunderrosettatranslation-macos-readonly-deprecated"><code>app.runningUnderRosettaTranslation</code> <em class="badge badge--primary">macOS</em> <em class="badge badge--info">Readonly</em> <em class="badge badge--danger">Deprecated</em><a aria-hidden="true" class="hash-link" href="#apprunningunderrosettatranslation-macos-readonly-deprecated" title="Direct link to heading"></a></h3><p>A <code>Boolean</code> which when <code>true</code> indicates that the app is currently running under the <a href="https://web.archive.org/web/20211123055155/https://en.wikipedia.org/wiki/Rosetta_(software)" target="_blank" rel="noopener noreferrer">Rosetta Translator Environment</a>.</p><p>You can use this property to prompt users to download the arm64 version of your application when they are running the x64 version under Rosetta incorrectly.</p><p><strong>Deprecated:</strong> This property is superceded by the <code>runningUnderARM64Translation</code> property which detects when the app is being translated to ARM64 in both macOS and Windows.</p><h3 class="anchor anchorWithStickyNavbar_31ik" id="apprunningunderarm64translation-readonly-macos-windows"><code>app.runningUnderARM64Translation</code> <em class="badge badge--info">Readonly</em> <em class="badge badge--primary">macOS</em> <em class="badge badge--primary">Windows</em><a aria-hidden="true" class="hash-link" href="#apprunningunderarm64translation-readonly-macos-windows" title="Direct link to heading"></a></h3><p>A <code>Boolean</code> which when <code>true</code> indicates that the app is currently running under an ARM64 translator (like the macOS <a href="https://web.archive.org/web/20211123055155/https://en.wikipedia.org/wiki/Rosetta_(software)" target="_blank" rel="noopener noreferrer">Rosetta Translator Environment</a> or Windows <a href="https://web.archive.org/web/20211123055155/https://en.wikipedia.org/wiki/Windows_on_Windows" target="_blank" rel="noopener noreferrer">WOW</a>).</p><p>You can use this property to prompt users to download the arm64 version of your application when they are running the x64 version under Rosetta incorrectly.</p></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://web.archive.org/web/20211123055155/https://github.com/electron/electron/edit/main/docs/api/app.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewbox="0 0 40 40" class="iconEdit_2_ui" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_13-_"></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><div class="pagination-nav__item"></div><div class="pagination-nav__item pagination-nav__item--next"><a class="pagination-nav__link" href="/web/20211123055155/https://www.electronjs.org/docs/latest/api/auto-updater"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">autoUpdater<!-- --> »</div></a></div></nav></div></div><div class="col col--3"><div class="tableOfContents_35-E thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#events" class="table-of-contents__link toc-highlight">Events</a><ul><li><a href="#event-will-finish-launching" class="table-of-contents__link toc-highlight"><code>'will-finish-launching'</code></a></li><li><a href="#event-ready" class="table-of-contents__link toc-highlight"><code>'ready'</code></a></li><li><a href="#event-window-all-closed" class="table-of-contents__link toc-highlight"><code>'window-all-closed'</code></a></li><li><a href="#event-before-quit" class="table-of-contents__link toc-highlight"><code>'before-quit'</code></a></li><li><a href="#event-will-quit" class="table-of-contents__link toc-highlight"><code>'will-quit'</code></a></li><li><a href="#event-quit" class="table-of-contents__link toc-highlight"><code>'quit'</code></a></li><li><a href="#event-open-file-macos" class="table-of-contents__link toc-highlight"><code>'open-file'</code></a></li><li><a href="#event-open-url-macos" class="table-of-contents__link toc-highlight"><code>'open-url'</code></a></li><li><a href="#event-activate-macos" class="table-of-contents__link toc-highlight"><code>'activate'</code></a></li><li><a href="#event-did-become-active-macos" class="table-of-contents__link toc-highlight"><code>'did-become-active'</code></a></li><li><a href="#event-continue-activity-macos" class="table-of-contents__link toc-highlight"><code>'continue-activity'</code></a></li><li><a href="#event-will-continue-activity-macos" class="table-of-contents__link toc-highlight"><code>'will-continue-activity'</code></a></li><li><a href="#event-continue-activity-error-macos" class="table-of-contents__link toc-highlight"><code>'continue-activity-error'</code></a></li><li><a href="#event-activity-was-continued-macos" class="table-of-contents__link toc-highlight"><code>'activity-was-continued'</code></a></li><li><a href="#event-update-activity-state-macos" class="table-of-contents__link toc-highlight"><code>'update-activity-state'</code></a></li><li><a href="#event-new-window-for-tab-macos" class="table-of-contents__link toc-highlight"><code>'new-window-for-tab'</code></a></li><li><a href="#event-browser-window-blur" class="table-of-contents__link toc-highlight"><code>'browser-window-blur'</code></a></li><li><a href="#event-browser-window-focus" class="table-of-contents__link toc-highlight"><code>'browser-window-focus'</code></a></li><li><a href="#event-browser-window-created" class="table-of-contents__link toc-highlight"><code>'browser-window-created'</code></a></li><li><a href="#event-web-contents-created" class="table-of-contents__link toc-highlight"><code>'web-contents-created'</code></a></li><li><a href="#event-certificate-error" class="table-of-contents__link toc-highlight"><code>'certificate-error'</code></a></li><li><a href="#event-select-client-certificate" class="table-of-contents__link toc-highlight"><code>'select-client-certificate'</code></a></li><li><a href="#event-login" class="table-of-contents__link toc-highlight"><code>'login'</code></a></li><li><a href="#event-gpu-info-update" class="table-of-contents__link toc-highlight"><code>'gpu-info-update'</code></a></li><li><a href="#event-gpu-process-crashed-deprecated" class="table-of-contents__link toc-highlight"><code>'gpu-process-crashed'</code></a></li><li><a href="#event-renderer-process-crashed-deprecated" class="table-of-contents__link toc-highlight"><code>'renderer-process-crashed'</code></a></li><li><a href="#event-render-process-gone" class="table-of-contents__link toc-highlight"><code>'render-process-gone'</code></a></li><li><a href="#event-child-process-gone" class="table-of-contents__link toc-highlight"><code>'child-process-gone'</code></a></li><li><a href="#event-accessibility-support-changed-macos-windows" class="table-of-contents__link toc-highlight"><code>'accessibility-support-changed'</code></a></li><li><a href="#event-session-created" class="table-of-contents__link toc-highlight"><code>'session-created'</code></a></li><li><a href="#event-second-instance" class="table-of-contents__link toc-highlight"><code>'second-instance'</code></a></li><li><a href="#event-desktop-capturer-get-sources" class="table-of-contents__link toc-highlight"><code>'desktop-capturer-get-sources'</code></a></li></ul></li><li><a href="#methods" class="table-of-contents__link toc-highlight">Methods</a><ul><li><a href="#appquit" class="table-of-contents__link toc-highlight"><code>quit</code></a></li><li><a href="#appexitexitcode" class="table-of-contents__link toc-highlight"><code>exit</code></a></li><li><a href="#apprelaunchoptions" class="table-of-contents__link toc-highlight"><code>relaunch</code></a></li><li><a href="#appisready" class="table-of-contents__link toc-highlight"><code>isReady</code></a></li><li><a href="#appwhenready" class="table-of-contents__link toc-highlight"><code>whenReady</code></a></li><li><a href="#appfocusoptions" class="table-of-contents__link toc-highlight"><code>focus</code></a></li><li><a href="#apphide-macos" class="table-of-contents__link toc-highlight"><code>hide</code></a></li><li><a href="#appshow-macos" class="table-of-contents__link toc-highlight"><code>show</code></a></li><li><a href="#appsetapplogspathpath" class="table-of-contents__link toc-highlight"><code>setAppLogsPath</code></a></li><li><a href="#appgetapppath" class="table-of-contents__link toc-highlight"><code>getAppPath</code></a></li><li><a href="#appgetpathname" class="table-of-contents__link toc-highlight"><code>getPath</code></a></li><li><a href="#appgetfileiconpath-options" class="table-of-contents__link toc-highlight"><code>getFileIcon</code></a></li><li><a href="#appsetpathname-path" class="table-of-contents__link toc-highlight"><code>setPath</code></a></li><li><a href="#appgetversion" class="table-of-contents__link toc-highlight"><code>getVersion</code></a></li><li><a href="#appgetname" class="table-of-contents__link toc-highlight"><code>getName</code></a></li><li><a href="#appsetnamename" class="table-of-contents__link toc-highlight"><code>setName</code></a></li><li><a href="#appgetlocale" class="table-of-contents__link toc-highlight"><code>getLocale</code></a></li><li><a href="#appgetlocalecountrycode" class="table-of-contents__link toc-highlight"><code>getLocaleCountryCode</code></a></li><li><a href="#appaddrecentdocumentpath-macos-windows" class="table-of-contents__link toc-highlight"><code>addRecentDocument</code></a></li><li><a href="#appclearrecentdocuments-macos-windows" class="table-of-contents__link toc-highlight"><code>clearRecentDocuments</code></a></li><li><a href="#appsetasdefaultprotocolclientprotocol-path-args" class="table-of-contents__link toc-highlight"><code>setAsDefaultProtocolClient</code></a></li><li><a href="#appremoveasdefaultprotocolclientprotocol-path-args-macos-windows" class="table-of-contents__link toc-highlight"><code>removeAsDefaultProtocolClient</code></a></li><li><a href="#appisdefaultprotocolclientprotocol-path-args" class="table-of-contents__link toc-highlight"><code>isDefaultProtocolClient</code></a></li><li><a href="#appgetapplicationnameforprotocolurl" class="table-of-contents__link toc-highlight"><code>getApplicationNameForProtocol</code></a></li><li><a href="#appgetapplicationinfoforprotocolurl-macos-windows" class="table-of-contents__link toc-highlight"><code>getApplicationInfoForProtocol</code></a></li><li><a href="#appsetusertaskstasks-windows" class="table-of-contents__link toc-highlight"><code>setUserTasks</code></a></li><li><a href="#appgetjumplistsettings-windows" class="table-of-contents__link toc-highlight"><code>getJumpListSettings</code></a></li><li><a href="#appsetjumplistcategories-windows" class="table-of-contents__link toc-highlight"><code>setJumpList</code></a></li><li><a href="#apprequestsingleinstancelock" class="table-of-contents__link toc-highlight"><code>requestSingleInstanceLock</code></a></li><li><a href="#apphassingleinstancelock" class="table-of-contents__link toc-highlight"><code>hasSingleInstanceLock</code></a></li><li><a href="#appreleasesingleinstancelock" class="table-of-contents__link toc-highlight"><code>releaseSingleInstanceLock</code></a></li><li><a href="#appsetuseractivitytype-userinfo-webpageurl-macos" class="table-of-contents__link toc-highlight"><code>setUserActivity</code></a></li><li><a href="#appgetcurrentactivitytype-macos" class="table-of-contents__link toc-highlight"><code>getCurrentActivityType</code></a></li><li><a href="#appinvalidatecurrentactivity-macos" class="table-of-contents__link toc-highlight"><code>invalidateCurrentActivity</code></a></li><li><a href="#appresigncurrentactivity-macos" class="table-of-contents__link toc-highlight"><code>resignCurrentActivity</code></a></li><li><a href="#appupdatecurrentactivitytype-userinfo-macos" class="table-of-contents__link toc-highlight"><code>updateCurrentActivity</code></a></li><li><a href="#appsetappusermodelidid-windows" class="table-of-contents__link toc-highlight"><code>setAppUserModelId</code></a></li><li><a href="#appsetactivationpolicypolicy-macos" class="table-of-contents__link toc-highlight"><code>setActivationPolicy</code></a></li><li><a href="#appimportcertificateoptions-callback-linux" class="table-of-contents__link toc-highlight"><code>importCertificate</code></a></li><li><a href="#appconfigurehostresolveroptions" class="table-of-contents__link toc-highlight"><code>configureHostResolver</code></a></li><li><a href="#appdisablehardwareacceleration" class="table-of-contents__link toc-highlight"><code>disableHardwareAcceleration</code></a></li><li><a href="#appdisabledomainblockingfor3dapis" class="table-of-contents__link toc-highlight"><code>disableDomainBlockingFor3DAPIs</code></a></li><li><a href="#appgetappmetrics" class="table-of-contents__link toc-highlight"><code>getAppMetrics</code></a></li><li><a href="#appgetgpufeaturestatus" class="table-of-contents__link toc-highlight"><code>getGPUFeatureStatus</code></a></li><li><a href="#appgetgpuinfoinfotype" class="table-of-contents__link toc-highlight"><code>getGPUInfo</code></a></li><li><a href="#appsetbadgecountcount-linux-macos" class="table-of-contents__link toc-highlight"><code>setBadgeCount</code></a></li><li><a href="#appgetbadgecount-linux-macos" class="table-of-contents__link toc-highlight"><code>getBadgeCount</code></a></li><li><a href="#appisunityrunning-linux" class="table-of-contents__link toc-highlight"><code>isUnityRunning</code></a></li><li><a href="#appgetloginitemsettingsoptions-macos-windows" class="table-of-contents__link toc-highlight"><code>getLoginItemSettings</code></a></li><li><a href="#appsetloginitemsettingssettings-macos-windows" class="table-of-contents__link toc-highlight"><code>setLoginItemSettings</code></a></li><li><a href="#appisaccessibilitysupportenabled-macos-windows" class="table-of-contents__link toc-highlight"><code>isAccessibilitySupportEnabled</code></a></li><li><a href="#appsetaccessibilitysupportenabledenabled-macos-windows" class="table-of-contents__link toc-highlight"><code>setAccessibilitySupportEnabled</code></a></li><li><a href="#appshowaboutpanel" class="table-of-contents__link toc-highlight"><code>showAboutPanel</code></a></li><li><a href="#appsetaboutpaneloptionsoptions" class="table-of-contents__link toc-highlight"><code>setAboutPanelOptions</code></a></li><li><a href="#appisemojipanelsupported" class="table-of-contents__link toc-highlight"><code>isEmojiPanelSupported</code></a></li><li><a href="#appshowemojipanel-macos-windows" class="table-of-contents__link toc-highlight"><code>showEmojiPanel</code></a></li><li><a href="#appstartaccessingsecurityscopedresourcebookmarkdata-mas" class="table-of-contents__link toc-highlight"><code>startAccessingSecurityScopedResource</code></a></li><li><a href="#appenablesandbox" class="table-of-contents__link toc-highlight"><code>enableSandbox</code></a></li><li><a href="#appisinapplicationsfolder-macos" class="table-of-contents__link toc-highlight"><code>isInApplicationsFolder</code></a></li><li><a href="#appmovetoapplicationsfolderoptions-macos" class="table-of-contents__link toc-highlight"><code>moveToApplicationsFolder</code></a></li><li><a href="#appissecurekeyboardentryenabled-macos" class="table-of-contents__link toc-highlight"><code>isSecureKeyboardEntryEnabled</code></a></li><li><a href="#appsetsecurekeyboardentryenabledenabled-macos" class="table-of-contents__link toc-highlight"><code>setSecureKeyboardEntryEnabled</code></a></li></ul></li><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#appaccessibilitysupportenabled-macos-windows" class="table-of-contents__link toc-highlight"><code>accessibilitySupportEnabled</code></a></li><li><a href="#appapplicationmenu" class="table-of-contents__link toc-highlight"><code>applicationMenu</code></a></li><li><a href="#appbadgecount-linux-macos" class="table-of-contents__link toc-highlight"><code>badgeCount</code></a></li><li><a href="#appcommandline-readonly" class="table-of-contents__link toc-highlight"><code>commandLine</code></a></li><li><a href="#appdock-macos-readonly" class="table-of-contents__link toc-highlight"><code>dock</code></a></li><li><a href="#appispackaged-readonly" class="table-of-contents__link toc-highlight"><code>isPackaged</code></a></li><li><a href="#appname" class="table-of-contents__link toc-highlight"><code>name</code></a></li><li><a href="#appuseragentfallback" class="table-of-contents__link toc-highlight"><code>userAgentFallback</code></a></li><li><a href="#apprunningunderrosettatranslation-macos-readonly-deprecated" class="table-of-contents__link toc-highlight"><code>runningUnderRosettaTranslation</code></a></li><li><a href="#apprunningunderarm64translation-readonly-macos-windows" class="table-of-contents__link toc-highlight"><code>runningUnderARM64Translation</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer"><div class="container"><div class="row footer__links"><div class="col footer__col"><div class="footer__title">Docs</div><ul class="footer__items"><li class="footer__item"><a class="footer__link-item" href="/web/20211123055155/https://www.electronjs.org/docs/latest/">Getting Started</a></li><li class="footer__item"><a class="footer__link-item" href="/web/20211123055155/https://www.electronjs.org/docs/latest/api/app">API Reference</a></li></ul></div><div class="col footer__col"><div class="footer__title">Checklists</div><ul class="footer__items"><li class="footer__item"><a class="footer__link-item" href="/web/20211123055155/https://www.electronjs.org/docs/latest/tutorial/performance">Performance</a></li><li class="footer__item"><a class="footer__link-item" href="/web/20211123055155/https://www.electronjs.org/docs/latest/tutorial/security">Security</a></li></ul></div><div class="col footer__col"><div class="footer__title">Community</div><ul class="footer__items"><li class="footer__item"><a class="footer__link-item" href="/web/20211123055155/https://www.electronjs.org/governance">Governance</a></li><li class="footer__item"><a href="https://web.archive.org/web/20211123055155/https://discordapp.com/invite/electron" target="_blank" rel="noopener noreferrer" class="footer__link-item"><span>Discord<svg width="13.5" height="13.5" aria-hidden="true" viewbox="0 0 24 24" class="iconExternalLink_3J9K"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></span></a></li><li class="footer__item"><a href="https://web.archive.org/web/20211123055155/https://twitter.com/electronjs" target="_blank" rel="noopener noreferrer" class="footer__link-item"><span>Twitter<svg width="13.5" height="13.5" aria-hidden="true" viewbox="0 0 24 24" class="iconExternalLink_3J9K"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></span></a></li><li class="footer__item"><a href="https://web.archive.org/web/20211123055155/https://stackoverflow.com/questions/tagged/electron" target="_blank" rel="noopener noreferrer" class="footer__link-item"><span>Stack Overflow<svg width="13.5" height="13.5" aria-hidden="true" viewbox="0 0 24 24" class="iconExternalLink_3J9K"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></span></a></li></ul></div><div class="col footer__col"><div class="footer__title">More</div><ul class="footer__items"><li class="footer__item"><a href="https://web.archive.org/web/20211123055155/https://github.com/electron/electron" target="_blank" rel="noopener noreferrer" class="footer__link-item"><span>GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewbox="0 0 24 24" class="iconExternalLink_3J9K"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></span></a></li><li class="footer__item"><a href="https://web.archive.org/web/20211123055155/https://opencollective.com/electron" target="_blank" rel="noopener noreferrer" class="footer__link-item"><span>Open Collective<svg width="13.5" height="13.5" aria-hidden="true" viewbox="0 0 24 24" class="iconExternalLink_3J9K"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></span></a></li></ul></div></div><div class="footer__bottom text--center"><div class="margin-bottom--sm"><a href="https://web.archive.org/web/20211123055155/https://openjsf.org/" target="_blank" rel="noopener noreferrer" class="footerLogoLink_MyFc"><img src="/web/20211123055155im_/https://www.electronjs.org/assets/img/openjsf_logo.svg" alt="OpenJS Foundation Logo" class="themedImage_1VuW themedImage--light_3UqQ footer__logo"><img src="/web/20211123055155im_/https://www.electronjs.org/assets/img/openjsf_logo.svg" alt="OpenJS Foundation Logo" class="themedImage_1VuW themedImage--dark_hz6m footer__logo"></a></div><div class="footer__copyright">Copyright © 2021 OpenJS Foundation and Electron contributors.</div></div></div></footer></div> <script src="/web/20211123055155js_/https://www.electronjs.org/assets/js/runtime~main.8dd3cf1f.js"></script> <script src="/web/20211123055155js_/https://www.electronjs.org/assets/js/main.924471fa.js"></script> </body> </html><!-- FILE ARCHIVED ON 05:51:55 Nov 23, 2021 AND RETRIEVED FROM THE INTERNET ARCHIVE ON 17:05:32 Feb 25, 2025. JAVASCRIPT APPENDED BY WAYBACK MACHINE, COPYRIGHT INTERNET ARCHIVE. ALL OTHER CONTENT MAY ALSO BE PROTECTED BY COPYRIGHT (17 U.S.C. SECTION 108(a)(3)). --> <!-- playback timings (ms): captures_list: 0.504 exclusion.robots: 0.037 exclusion.robots.policy: 0.028 esindex: 0.009 cdx.remote: 38.001 LoadShardBlock: 281.971 (3) PetaboxLoader3.datanode: 532.805 (4) PetaboxLoader3.resolve: 216.393 (2) load_resource: 516.844 -->